Skip to content

Sema: incorrectly simplifies runtime float vectors multiplied by zeros #22745

@jacobly0

Description

@jacobly0
const std = @import("std");
const nan = std.math.nan;
var rt_nan: @Vector(1, f32) = .{nan(f32)};
var rt_zero: @Vector(1, f32) = .{0};
const ct_zero: @Vector(1, f32) = .{0};
pub fn main() void {
    std.debug.print("{} {}\n", .{ rt_nan * rt_zero, rt_nan * ct_zero });
}
$ zig run repro.zig
{ nan } { 0e0 }

As an added bonus for fixing this bug, you can delete the lines in test/behavior/x86_64/math.zig referencing this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions