Skip to content

stage1: @floatToInt safety check causes LLVM segfault on aarch64-linux-none #11408

@topolarity

Description

@topolarity

Zig Version

0.10.0-dev.1740+23715dcf6

Steps to Reproduce

Execute the following test with -target aarch64-linux-none or arm-linux-none:

test {
    var y = @as(f80, 2.5);
    try testing.expect(@floatToInt(u80, y) != 0);
}

Expected Behavior

Compilation and test should both succeed.

Actual Behavior

Segfault occurs in LLVMConstReal when adding the safety check for the floatToInt operation (codegen.cpp:3854):

Segmentation fault at address 0x16b0
???:?:?: 0x63d64c9 in ??? (???)
[1]    6592 IOT instruction  ./build/zig test testme.zig -target aarch64-linux-none --zig-lib-dir lib

I believe the problem is that we are lowering a FP constant for a value that we actually lower as an integer on ARM (and the safety check therefore also needs to be implemented in soft ops).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstage1The process of building from source via WebAssembly and the C backend.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions