Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler_rt fails to compile for AVR #22985

Open
mattnite opened this issue Feb 23, 2025 · 0 comments
Open

compiler_rt fails to compile for AVR #22985

mattnite opened this issue Feb 23, 2025 · 0 comments
Labels
arch-avr 8-bit AVR bug Observed behavior contradicts documented or intended behavior compiler-rt enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Milestone

Comments

@mattnite
Copy link
Contributor

Zig Version

0.14.0-dev.3296+a7467b9bb

Steps to Reproduce and Observed Behavior

Run zig build for this repo, which provides the bare minimum to reproduce. Here is the build output:

install
└─ install reproduce-avr-compiler-rt-error
   └─ zig build-exe reproduce-avr-compiler-rt-error Debug avr-freestanding-eabi 1 errors
error: sub-compilation of compiler_rt failed
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: expected type 'usize', found 'u31'
            @memset(result[0..exponent_limb], switch (endian) {
                              ^~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixhfei.zig:12:27: note: called from here
    return bigIntFromFloat(.signed, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: expected type 'usize', found 'u31'
            @memset(result[0..exponent_limb], switch (endian) {
                              ^~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixsfei.zig:12:27: note: called from here
    return bigIntFromFloat(.signed, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: expected type 'usize', found 'u31'
            @memset(result[0..exponent_limb], switch (endian) {
                              ^~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixdfei.zig:12:27: note: called from here
    return bigIntFromFloat(.signed, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: expected type 'usize', found 'u31'
            @memset(result[0..exponent_limb], switch (endian) {
                              ^~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixtfei.zig:12:27: note: called from here
    return bigIntFromFloat(.signed, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: expected type 'usize', found 'u31'
            @memset(result[0..exponent_limb], switch (endian) {
                              ^~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:88:31: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixxfei.zig:12:27: note: called from here
    return bigIntFromFloat(.signed, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: expected type 'usize', found 'u31'
    std.mem.writePackedIntNative(I, std.mem.sliceAsBytes(result), exponent, int);
                                                                  ^~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/std/mem.zig:1963:68: note: parameter type declared here
fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void {
                                                                   ^~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixunshfei.zig:12:27: note: called from here
    return bigIntFromFloat(.unsigned, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: expected type 'usize', found 'u31'
    std.mem.writePackedIntNative(I, std.mem.sliceAsBytes(result), exponent, int);
                                                                  ^~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/std/mem.zig:1963:68: note: parameter type declared here
fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void {
                                                                   ^~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixunssfei.zig:12:27: note: called from here
    return bigIntFromFloat(.unsigned, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: expected type 'usize', found 'u31'
    std.mem.writePackedIntNative(I, std.mem.sliceAsBytes(result), exponent, int);
                                                                  ^~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/std/mem.zig:1963:68: note: parameter type declared here
fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void {
                                                                   ^~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixunsdfei.zig:12:27: note: called from here
    return bigIntFromFloat(.unsigned, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: expected type 'usize', found 'u31'
    std.mem.writePackedIntNative(I, std.mem.sliceAsBytes(result), exponent, int);
                                                                  ^~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/std/mem.zig:1963:68: note: parameter type declared here
fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void {
                                                                   ^~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixunstfei.zig:12:27: note: called from here
    return bigIntFromFloat(.unsigned, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: expected type 'usize', found 'u31'
    std.mem.writePackedIntNative(I, std.mem.sliceAsBytes(result), exponent, int);
                                                                  ^~~~~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/int_from_float.zig:100:67: note: unsigned 16-bit int cannot represent all possible unsigned 31-bit values
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/std/mem.zig:1963:68: note: parameter type declared here
fn writePackedIntLittle(comptime T: type, bytes: []u8, bit_offset: usize, value: T) void {
                                                                   ^~~~~
    /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/compiler_rt/fixunsxfei.zig:12:27: note: called from here
    return bigIntFromFloat(.unsigned, r[0 .. divCeil(usize, bits, 32) catch unreachable], a);
           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: the following command failed with 1 compilation errors:
/Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/zig build-exe -ODebug -target avr-freestanding-eabi -mcpu avr5 -Mroot=/Users/mattnite/code/reproduce-avr-compiler-rt-error/src/main.zig --cache-dir /Users/mattnite/code/reproduce-avr-compiler-rt-error/.zig-cache --global-cache-dir /Users/mattnite/.cache/zig --name reproduce-avr-compiler-rt-error --zig-lib-dir /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib/ --listen=-
Build Summary: 0/3 steps succeeded; 1 failed
install transitive failure
└─ install reproduce-avr-compiler-rt-error transitive failure
   └─ zig build-exe reproduce-avr-compiler-rt-error Debug avr-freestanding-eabi 1 errors
error: the following build command failed with exit code 1:
/Users/mattnite/code/reproduce-avr-compiler-rt-error/.zig-cache/o/95546235ad67c67b126c526a3eada073/build /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/zig /Users/mattnite/zig/0.14.0-dev.3287+65e7ede49/files/lib /Users/mattnite/code/reproduce-avr-compiler-rt-error /Users/mattnite/code/reproduce-avr-compiler-rt-error/.zig-cache /Users/mattnite/.cache/zig --seed 0xa73a1960 -Z1df4e6250195e691

Expected Behavior

The expected behaviour is for compiler_rt to successfully compile for AVR.

@mattnite mattnite added the bug Observed behavior contradicts documented or intended behavior label Feb 23, 2025
@andrewrk andrewrk added arch-avr 8-bit AVR enhancement Solving this issue will likely involve adding new logic or components to the codebase. labels Feb 23, 2025
@andrewrk andrewrk added this to the 0.16.0 milestone Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-avr 8-bit AVR bug Observed behavior contradicts documented or intended behavior compiler-rt enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

No branches or pull requests

3 participants