https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88435
Bug ID: 88435 Summary: Compiling with optimizations causes the compiler to fail. Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: mattis at mattisborgen dot se Target Milestone: --- pdp11-aout-gcc -save-temps -O2 -v -m10 -Ttext 1000 -msoft-float -nostartfiles -nodefaultlibs -nostdlib -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations gccbug.c Using built-in specs. COLLECT_GCC=pdp11-aout-gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/pdp11-aout/8.2.0/lto-wrapper Target: pdp11-aout Configured with: ./configure --target=pdp11-aout --disable-nls --without-headers --enable-languages=c Thread model: single gcc version 8.2.0 (GCC) COLLECT_GCC_OPTIONS='-save-temps' '-O2' '-v' '-m10' '-Ttext' '1000' '-msoft-float' '-nostartfiles' '-nodefaultlibs' '-nostdlib' '-fno-strict-aliasing' '-fwrapv' '-fno-aggressive-loop-optimizations' /usr/local/libexec/gcc/pdp11-aout/8.2.0/cc1 -E -quiet -v -imultilib msoft-float gccbug.c -m10 -msoft-float -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -O2 -fpch-preprocess -o gccbug.i ignoring nonexistent directory "/usr/local/lib/gcc/pdp11-aout/8.2.0/../../../../pdp11-aout/sys-include" ignoring nonexistent directory "/usr/local/lib/gcc/pdp11-aout/8.2.0/../../../../pdp11-aout/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/pdp11-aout/8.2.0/include /usr/local/lib/gcc/pdp11-aout/8.2.0/include-fixed End of search list. COLLECT_GCC_OPTIONS='-save-temps' '-O2' '-v' '-m10' '-Ttext' '1000' '-msoft-float' '-nostartfiles' '-nodefaultlibs' '-nostdlib' '-fno-strict-aliasing' '-fwrapv' '-fno-aggressive-loop-optimizations' /usr/local/libexec/gcc/pdp11-aout/8.2.0/cc1 -fpreprocessed gccbug.i -quiet -dumpbase gccbug.c -m10 -msoft-float -auxbase gccbug -O2 -version -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -o gccbug.s GNU C17 (GCC) version 8.2.0 (pdp11-aout) compiled by GNU C version 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.76), GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C17 (GCC) version 8.2.0 (pdp11-aout) compiled by GNU C version 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.76), GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version none GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: bc392ef67ca9ec448731a9f0a726ee14 gccbug.c: In function 'pollConsole': gccbug.c:11:1: error: unrecognizable insn: } ^ (insn 13 12 14 2 (set (reg:SI 35) (ashift:SI (reg:SI 34) (const_int -9 [0xfffffffffffffff7]))) "gccbug.c":5 -1 (nil)) during RTL pass: vregs gccbug.c:11:1: internal compiler error: in extract_insn, at recog.c:2304 libbacktrace could not find executable to open Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. $ cat gccbug.c int pollConsole () { volatile unsigned int * rxcsr = (unsigned int *) 0177560; unsigned int tmp = 512 & *rxcsr; if (tmp == 512) { return 1; } else { return 0; } } The compile fail if the two literals 512 is equal and greater than 16. It also has to have one single bit set. I.e. 32, 64, 128... 33,34 woks fine. $ cat gccbug.i # 1 "gccbug.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "gccbug.c" int pollConsole () { volatile unsigned int * rxcsr = (unsigned int *) 0177560; unsigned int tmp = 512 & *rxcsr; if (tmp == 512) { return 1; } else { return 0; } }