https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110307
Bug ID: 110307 Summary: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 Product: gcc Version: 13.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: matoro_gcc_bugzilla at matoro dot tk Target Milestone: --- Minimized reproducer: $ cat test.c _Thread_local struct rb_execution_context_struct ruby_current_ec; struct rb_execution_context_struct { int fiber_ptr } rb_fiber_start() { __builtin_setjmp(0); if (ruby_current_ec.fiber_ptr) root_fiber_alloc(); } $ alpha-unknown-linux-gnu-gcc -O1 -fpeephole2 -fschedule-insns2 -fPIC test.c -o test.o -c test.c:4:1: warning: no semicolon at end of struct or union 4 | } rb_fiber_start() { | ^ test.c: In function ‘rb_fiber_start’: test.c:7:5: warning: implicit declaration of function ‘root_fiber_alloc’ [-Wimplicit-function-declaration] 7 | root_fiber_alloc(); | ^~~~~~~~~~~~~~~~ during RTL pass: sched2 test.c:8:1: internal compiler error: in move_insn, at haifa-sched.cc:5473 8 | } | ^ -fPIC is required to reproduce, as well as both -fpeephole2 and -fschedule-insns2 optimizers (or simply -O2 which includes them). Removing any of those three flags no longer reproduces. If required I can also work on getting a complete stack trace. If somebody would like to take a look at this without the appropriate hardware, mine is publicly available for use. $ alpha-unknown-linux-gnu-gcc --version --verbose Using built-in specs. COLLECT_AS_OPTIONS='--version' COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/alpha-unknown-linux-gnu/13/lto-wrapper gcc (Gentoo 13.1.1_p20230527 p3) 13.1.1 20230527 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Target: alpha-unknown-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-13.1.1_p20230527/work/gcc-13-20230527/configure --host=alpha-unknown-linux-gnu --build=alpha-unknown-linux-gnu --prefix=/usr --bindir=/usr/alpha-unknown-linux-gnu/gcc-bin/13 --includedir=/usr/lib/gcc/alpha-unknown-linux-gnu/13/include --datadir=/usr/share/gcc-data/alpha-unknown-linux-gnu/13 --mandir=/usr/share/gcc-data/alpha-unknown-linux-gnu/13/man --infodir=/usr/share/gcc-data/alpha-unknown-linux-gnu/13/info --with-gxx-include-dir=/usr/lib/gcc/alpha-unknown-linux-gnu/13/include/g++-v13 --with-python-dir=/share/gcc-data/alpha-unknown-linux-gnu/13/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 13.1.1_p20230527 p3' --with-gcc-major-version-only --disable-esp --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --disable-fixed-point --enable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --without-zstd --without-isl --disable-libsanitizer --enable-default-pie --disable-default-ssp Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.1.1 20230527 (Gentoo 13.1.1_p20230527 p3) COLLECT_GCC_OPTIONS='--version' '-v' '-dumpdir' 'a-' /usr/libexec/gcc/alpha-unknown-linux-gnu/13/cc1 -quiet -v help-dummy -quiet -dumpdir a- -dumpbase help-dummy -version --version -o /tmp/ccNd1lqC.s GNU C17 (Gentoo 13.1.1_p20230527 p3) version 13.1.1 20230527 (alpha-unknown-linux-gnu) compiled by GNU C version 13.1.1 20230527, GMP version 6.2.1, MPFR version 4.2.0-p9, MPC version 1.3.1, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 COLLECT_GCC_OPTIONS='--version' '-v' '-dumpdir' 'a-' /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/bin/as -v --version -o /tmp/ccq4Tbtn.o /tmp/ccNd1lqC.s GNU assembler version 2.40.0 (alpha-unknown-linux-gnu) using BFD version (Gentoo 2.40 p5) 2.40.0 GNU assembler (Gentoo 2.40 p5) 2.40.0 Copyright (C) 2023 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `alpha-unknown-linux-gnu'. COMPILER_PATH=/usr/libexec/gcc/alpha-unknown-linux-gnu/13/:/usr/libexec/gcc/alpha-unknown-linux-gnu/13/:/usr/libexec/gcc/alpha-unknown-linux-gnu/:/usr/lib/gcc/alpha-unknown-linux-gnu/13/:/usr/lib/gcc/alpha-unknown-linux-gnu/:/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/bin/ LIBRARY_PATH=/usr/lib/gcc/alpha-unknown-linux-gnu/13/:/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/lib/:/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='--version' '-v' '-dumpdir' 'a.' /usr/libexec/gcc/alpha-unknown-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/alpha-unknown-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/alpha-unknown-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/cckUzA7Z.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf64alpha -O1 -dynamic-linker /lib/ld-linux.so.2 -pie --version /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crt1.o /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crti.o /usr/lib/gcc/alpha-unknown-linux-gnu/13/crtbegin.o -L/usr/lib/gcc/alpha-unknown-linux-gnu/13 -L/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/lib -L/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../.. /tmp/ccq4Tbtn.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/alpha-unknown-linux-gnu/13/crtend.o /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crtn.o collect2 version 13.1.1 20230527 /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/bin/ld -plugin /usr/libexec/gcc/alpha-unknown-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/alpha-unknown-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/cckUzA7Z.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf64alpha -O1 -dynamic-linker /lib/ld-linux.so.2 -pie --version /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crt1.o /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crti.o /usr/lib/gcc/alpha-unknown-linux-gnu/13/crtbegin.o -L/usr/lib/gcc/alpha-unknown-linux-gnu/13 -L/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/lib -L/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../.. /tmp/ccq4Tbtn.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/alpha-unknown-linux-gnu/13/crtend.o /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crtn.o GNU ld (Gentoo 2.40 p5) 2.40.0 Copyright (C) 2023 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty. COLLECT_GCC_OPTIONS='--version' '-v' '-dumpdir' 'a.'