https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104337
Bug ID: 104337 Summary: ICE when compiling with optimize attribute at -m32 -g3 -O0 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: tlwang at uwaterloo dot ca Target Milestone: --- This occurs in attributes_transformed_program0_preprocessed.c, shown below: $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/configure --enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch --prefix=/scratch/software/gcc-trunk --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.1 20220201 (experimental) [master -g1bb526625] (GCC) $ $ cat attributes_transformed_program0_preprocessed.c struct a { unsigned b : 7; }; __attribute__((optimize(3))) __attribute__((always_inline)) struct a c() { struct a d; return d; } void e() { for (;;) c(); } int main() {} $ $ gcc-trunk -m32 -O0 -g3 attributes_transformed_program0_preprocessed.c attributes_transformed_program0_preprocessed.c:4:70: warning: ‘always_inline’ function might not be inlinable [-Wattributes] 4 | __attribute__((optimize(3))) __attribute__((always_inline)) struct a c() { | ^ during RTL pass: final attributes_transformed_program0_preprocessed.c: In function ‘e’: attributes_transformed_program0_preprocessed.c:11:1: internal compiler error: in decl_ultimate_origin, at dwarf2out.cc:4466 11 | } | ^ 0x71239e decl_ultimate_origin /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:4466 0x71239e decl_ultimate_origin /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:4454 0xbb0b17 process_scope_var /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:26452 0xbb0c2f decls_for_scope /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:26515 0xbd36c6 gen_inlined_subroutine_die /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:24964 0xbd36c6 gen_block_die /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:26419 0xbb0cea decls_for_scope /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:26544 0xbb14a2 gen_subprogram_die /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:24026 0xbcf88f gen_decl_die /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:26952 0xbd11f6 dwarf2out_decl /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:27530 0xbd1572 dwarf2out_function_decl /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/dwarf2out.cc:27545 0xc34e70 rest_of_handle_final /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/final.cc:4321 0xc34e70 execute /tmp/tmp.JKF7BF3fiK-gcc-builder/gcc/gcc/final.cc:4363 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.