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

ICE: error: bitcast with types of different sizes #297

Open
matthiaskrgr opened this issue Jul 1, 2023 · 0 comments
Open

ICE: error: bitcast with types of different sizes #297

matthiaskrgr opened this issue Jul 1, 2023 · 0 comments

Comments

@matthiaskrgr
Copy link
Member

#![allow(dead_code)]

#[repr(C)]
#[derive(Copy, Clone)]
pub struct Floats {
    a: f64,
    b: u8,
    c: f64,
}


mod rustrt {
    use super::{Floats};

    extern "C" {
        pub fn rust_dbg_abi_2(f: Floats) -> Floats;
    }
}

fn test2() {
    unsafe {
        let f = Floats { a: 1.234567890e-15_f64, b: 0b_1010_1010, c: 1.0987654321e-15_f64 };
        let ff = rustrt::rust_dbg_abi_2(f);
    }
}

pub fn main() {
    test2();
}
warning: unused variable: `ff`
  --> struct-return.rs:23:13
   |
23 |         let ff = rustrt::rust_dbg_abi_2(f);
   |             ^^ help: if this is intentional, prefix it with an underscore: `_ff`
   |
   = note: `#[warn(unused_variables)]` on by default

libgccjit.so: error: bitcast with types of different sizes
input expression (size: 64):
 <addr_expr 0x7fba6bc2c140
    type <pointer_type 0x7fba6bc2b540
        type <record_type 0x7fba6bc2b498  BLK
            size <integer_cst 0x7fba6c124120 constant 192>
            unit-size <integer_cst 0x7fba6c124150 constant 24>
            user align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fba6bc28dc8 fields <field_decl 0x7fba6bc0ad10 field_0>
            pointer_to_this <pointer_type 0x7fba6bc2b540>>
        unsigned DI
        size <integer_cst 0x7fba6c118c90 constant 64>
        unit-size <integer_cst 0x7fba6c118ca8 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fba6bc28d20>
    visited
    arg:0 <var_decl 0x7fba6bc275a0 stack_var_1 type <record_type 0x7fba6bc2b498 >
        addressable visited BLK (null):0:0 size <integer_cst 0x7fba6c124120 192> unit-size <integer_cst 0x7fba6c124150 24>
        align:64 warn_if_not_align:0 context <function_decl 0x7fba6bc1b500 _ZN13struct_return5test217h02d4cb3545bc47b6E>
        chain <var_decl 0x7fba6bc27510 stack_var_2 type <record_type 0x7fba6bc28e70 >
            addressable visited BLK (null):0:0 size <integer_cst 0x7fba6c124120 192> unit-size <integer_cst 0x7fba6c124150 24>
            align:64 warn_if_not_align:0 context <function_decl 0x7fba6bc1b500 _ZN13struct_return5test217h02d4cb3545bc47b6E> chain <var_decl 0x7fba6bc27480 stack_var_1>>>>
requested type (size: 192):
 <record_type 0x7fba6bc28dc8  BLK
    size <integer_cst 0x7fba6c124120 type <integer_type 0x7fba6c0ff0a8 bitsizetype> constant 192>
    unit-size <integer_cst 0x7fba6c124150 type <integer_type 0x7fba6c0ff000 sizetype> constant 24>
    align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fba6bc28dc8
    fields <field_decl 0x7fba6bc0ad10 field_0
        type <array_type 0x7fba6bc13c78 type <integer_type 0x7fba6c0ffdc8 long int>
            BLK
            size <integer_cst 0x7fba6c118d08 constant 0>
            unit-size <integer_cst 0x7fba6c118cc0 constant 0>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fba6bc13c78 domain <integer_type 0x7fba6bc13bd0>>
        BLK (null):0:0 size <integer_cst 0x7fba6c118d08 0> unit-size <integer_cst 0x7fba6c118cc0 0>
        align:64 warn_if_not_align:0 offset_align 256 decl_not_flexarray: 0 offset <integer_cst 0x7fba6c118cc0 0> bit-offset <integer_cst 0x7fba6c118d08 0> context <record_type 0x7fba6bc28dc8 >
        chain <field_decl 0x7fba6bc0ada8 field_1 type <real_type 0x7fba6c121a80 double>
            DF (null):0:0
            size <integer_cst 0x7fba6c118c90 constant 64>
            unit-size <integer_cst 0x7fba6c118ca8 constant 8>
            align:64 warn_if_not_align:0 offset_align 256 decl_not_flexarray: 0 offset <integer_cst 0x7fba6c118cc0 0> bit-offset <integer_cst 0x7fba6c118d08 0> context <record_type 0x7fba6bc28dc8 > chain <field_decl 0x7fba6bc0ae40 field_2>>>
    pointer_to_this <pointer_type 0x7fba6bc28d20>>
error: linking with `cc` failed: exit status: 1
  |
  = note: LC_ALL="C" PATH="/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/bin:/home/matthias/.cargo/bin:/home/matthias/bin:/usr/local/bin:/home/matthias/.cargo/bin:/home/matthias/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/home/matthias/.dotnet/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin:/var/lib/snapd/snap/bin" VSLANG="1033" "cc" "-m64" "/tmp/rustcIkYMfd/symbols.o" "struct-return.struct_return.a49734a482d16c59-cgu.0.rcgu.o" "struct-return.1ep5rirkgdd51ahb.rcgu.o" "-Wl,--as-needed" "-L" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-cb92768712601a78.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-64fdea3f4b4483a9.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-7131d4e480a39cf1.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-5b0b0d3b7d32a280.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-ecb3c4cbccea6ca3.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-21489f6fc83bcf9c.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-4235769adaec73dc.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-39978a3c90cbbb03.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-2bcf5035b2e8207a.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-1f4a77c098ecaa29.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-d85c31e2a520cb57.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-af274bde543c4a19.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-54f3ccd06893aed8.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-99aff24c233bd0c8.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-4a9ff6e26a937e19.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-1ab040c8d581c1d5.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1be5ab1a73b8d3c1.rlib" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-eaa0474023498767.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "struct-return" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: cannot find struct-return.struct_return.a49734a482d16c59-cgu.0.rcgu.o: No such file or directory
          /usr/bin/ld: warning: alignment 8 of symbol `_RNvNtNtNtCsle4rNbiKmem_4core3num7dec2flt5table17POWER_OF_FIVE_128' in /home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1be5ab1a73b8d3c1.rlib(core-1be5ab1a73b8d3c1.core.f73e5ae8f2233ce4-cgu.3.rcgu.o) is smaller than 32 in /home/matthias/vcs/github/rustc_codegen_gcc_attempt2/rustc_codegen_gcc/build_sysroot/sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-1be5ab1a73b8d3c1.rlib(core-1be5ab1a73b8d3c1.core.f73e5ae8f2233ce4-cgu.11.rcgu.o)
          collect2: error: ld returned 1 exit status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant