https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87672
Bug ID: 87672 Summary: [9 regression] 81512c36 causes ICE in bootstrap stage 3 using "-D_FORTIFY_SOURCE=2" (invalid operand in unary operation, incorrect sharing of tree nodes, verify_gimple failed) Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: jamespharvey20 at gmail dot com Target Milestone: --- Created attachment 44867 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44867&action=edit [Part 0] i386.ii On trunk commit 7961f40be4b4a5d9c8531e6f78ecf330411d5d9f (2018-09-25) this succeeds: (in gcc git dir) $ sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure (in gcc build dir) $ export CPPFLAGS="-D_FORTIFY_SOURCE=2" $ <gcc git dir>/configure --disable-werror { [make] || [make -j] } Trunk commit 81512c36496bd5c3bc35746603dc988f0bc85f57 or anything newer, including current trunk/master, causes the following build failure. With my basic knowledge of the bootstrap process, I'm very surprised it compiles in stage 2 but then fails in stage 3, but that's what happens. I lost track of how many times I've confirmed this, performing a bisect, at first going down a wrong path of what I thought was causing this, then creating reduced steps. It's 100% reproduceable, where before commit 81512c compiles, and at or after it fails with this error message. (With all of Arch's normal build flags the first two errors are given but the internal compiler error isn't, until it's pruned down.) It's not a hardware issue. Kernel compiles fine. System is rock solid. Memtest passes 16+ hours. In case someone a response is going to be given that I shouldn't be modifying these configure files this way, or using D_FORTIFY_SOURCE, I'll respond to that. Arch Linux has been compiling gcc this exact way since 4.8.0-2 (2013-04-12) without problems. (Arch of course customizes more than this, but I've reduced it down to the combination of the sed and CPPFLAGS.) I understand that upstream changes can and should require distributions to modify their build process, especially distribution-specific ones, but: (1) Even if true, this commit is causing an internal compiler error which should not happen. (2) Even if true, it's worrisome (at least to me, given my limited boostrap process knowledge) that stage 2 can complete, but stage 3 can fail. (3) I just view this as if Arch's normal gcc build process tests/stresses gcc's code a bit more than others might. (No idea if other distributions perform these steps or not.) After make failed, I re-ran the failing command with the "-save-temps" option to get the preprocess file. The max attachment here is 1000 KB, and it's 5M, so I'm attaching 6 separate files from split. I've also verified combining them in order is identical to my original i386.ii. System is up-to-date Arch. gcc 8.2.1, binutils 2.31.1, linux 4.18.14. You can pull up the version of any other package at archlinux.org/packages by typing the package name into Keywords. ... Configuring stage 3 in ./gcc ... /home/jamespharvey20/gcc.mirror.git.build.git/build/./prev-gcc/xg++ -B/home/jamespharvey20/gcc.mirror.git.build.git/build/./prev-gcc/ -B/usr/local/x86_64-pc-linux-gnu/bin/ -nostdinc++ -B/home/jamespharvey20/gcc.mirror.git.build.git/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -B/home/jamespharvey20/gcc.mirror.git.build.git/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -I/home/jamespharvey20/gcc.mirror.git.build.git/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu -I/home/jamespharvey20/gcc.mirror.git.build.git/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/include -I/home/jamespharvey20/gcc.mirror.git.build.git/gcc.mirror.git.local/libstdc++-v3/libsupc++ -L/home/jamespharvey20/gcc.mirror.git.build.git/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/home/jamespharvey20/gcc.mirror.git.build.git/build/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c -g -O2 -fchecking=1 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc.mirror.git.local/gcc -I../../gcc.mirror.git.local/gcc/. -I../../gcc.mirror.git.local/gcc/../include -I../../gcc.mirror.git.local/gcc/../libcpp/include -I../../gcc.mirror.git.local/gcc/../libdecnumber -I../../gcc.mirror.git.local/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc.mirror.git.local/gcc/../libbacktrace -D_FORTIFY_SOURCE=2 -o i386.o -MT i386.o -MMD -MP -MF ./.deps/i386.TPo ../../gcc.mirror.git.local/gcc/config/i386/i386.c ../../gcc.mirror.git.local/gcc/config/i386/i386.c: In function ‘const char* output_fix_trunc(rtx_insn*, rtx_def**, bool)’: ../../gcc.mirror.git.local/gcc/config/i386/i386.c:19200:1: error: invalid operand in unary operation 19200 | output_fix_trunc (rtx_insn *insn, rtx *operands, bool fisttp) | ^~~~~~~~~~~~~~~~ ../../gcc.mirror.git.local/gcc/config/i386/i386.c:19200:1: error: incorrect sharing of tree nodes (ssizetype) _19 _58 = (long unsigned int) ((ssizetype) _19 <= 7 ? 7 - (ssizetype) _19 : 0); during GIMPLE pass: vrp ../../gcc.mirror.git.local/gcc/config/i386/i386.c:19200:1: internal compiler error: verify_gimple failed Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. make[3]: *** [Makefile:2245: i386.o] Error 1 make[3]: Leaving directory '/home/jamespharvey20/gcc.mirror.git.build.git/build/gcc' make[2]: *** [Makefile:4689: all-stage3-gcc] Error 2 make[2]: Leaving directory '/home/jamespharvey20/gcc.mirror.git.build.git/build' make[1]: *** [Makefile:24118: stage3-bubble] Error 2 make[1]: Leaving directory '/home/jamespharvey20/gcc.mirror.git.build.git/build' make: *** [Makefile:952: all] Error 2