Skip to content

trunc_sat instructions lack proper saturation (NaN/out-of-range -> UB) #116

Description

@saza-ku

trunc_sat instructions must saturate on NaN and out-of-range inputs, but some current implementations appear to be plain trunc (e.g., I32TruncSatF64S uses build_float_to_signed_int without clamping). This can lead to undefined behavior for NaN/out-of-range values.

Affected area:

  • mod.rs

Expected behavior:

  • NaN → 0
  • Out-of-range → clamp to min/max

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions