Bug 82385

Summary: ICE in extract_constraint_insn, at recog.c:2213
Product: gcc Reporter: Dakotah Lambert <vvulpes0>
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal Keywords: ice-on-valid-code
Priority: P3    
Version: 7.2.0   
Target Milestone: ---   
Host: Target: m68k-elf
Build: Known to work:
Known to fail: 6.4.0, 7.2.0, 8.0 Last reconfirmed: 2017-10-02 00:00:00
Attachments: test.c
test.c

Description Dakotah Lambert 2017-10-01 22:41:08 UTC
Created attachment 42271 [details]
test.c

A combination of -mpcrel and any -O switch causes an internal compiler error in

$ m68k-elf-gcc -march=isaa -mpcrel -O -c test.c

The error appears for all and only the ColdFire architectures; plain 680x0 and cpu32 compile fine.  The error reported is:


test.c: In function 'f':
test.c:5:1: error: insn does not satisfy its constraints:
 }
 ^

(insn 7 20 8 2 (set (reg:SI 0 %d0 [36])
        (and:SI (reg:SI 0 %d0 [36])
            (mem/c:SI (symbol_ref:SI ("b") <var_decl 0x7f609df03480 b>) [1 b+0 S4 A16]))) "test.c":3 230 {andsi3_5200}
     (nil))
test.c:5:1: internal compiler error: in extract_constrain_insn, at recog.c:2213


Using this command to turn on nearly every -f* optimization:

$ m68k-elf-gcc -march=isaa -mpcrel \
  $(m68k-elf-gcc -c -Q --help=optimizers,^joined \
    | awk '/ *-f/ { print $1 }') -c test.c

succeeds, creating a test.o output file.  On the other hand, using "-O" and turning all of these options off with:

$ m68k-elf-gcc -march=isaa -mpcrel -O \
  $(m68k-elf-gcc -c -Q --help=optimizers,^joined \
    | awk '/ *-f/ && !/stack-protector/ {
             sub("^-f","-fno",$1);
             sub("-fno-no-","-f");
             print $1
           }') -c test.c

fails, producing the same error message as previosly shown.

Verbose version information:


$ m68k-elf-gcc -v -march=isaa -O -mpcrel -c test.c
Using built-in specs.
COLLECT_GCC=m68k-elf-gcc
Target: m68k-elf
Configured with: /home/fox/Builds/m68k-elf-gcc/src/gcc-7.2.0/configure --target=m68k-elf --prefix=/opt/toolchains/m68k --with-cpu=68000 --with-arch=m68k --with-sysroot=/opt/toolchains/m68k --with-native-system-header-dir=/include --enable-multilib --enable-target-optspace --enable-languages=c,c++ --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libsp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-system-zlib --with-newlib --with-headers=/opt/toolchains/m68k/include --with-python-dir=share/gcc-m68k-elf --with-gmp --with-mpfr --with-mpc --with-isl --with-libelf --enable-gnu-indirect-function --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-checking=release
Thread model: single
gcc version 7.2.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '-march=isaa' '-O' '-mpcrel' '-c'
 /opt/toolchains/m68k/libexec/gcc/m68k-elf/7.2.0/cc1 -quiet -v test.c -quiet -dumpbase test.c -march=isaa -mpcrel -auxbase test -O -version -o /tmp/ccM0RTJ2.s
GNU C11 (GCC) version 7.2.0 (m68k-elf)
        compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version 3.1.5-p2, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/opt/toolchains/m68k/usr/local/include"
ignoring nonexistent directory "/opt/toolchains/m68k/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/toolchains/m68k/lib/gcc/m68k-elf/7.2.0/include
 /opt/toolchains/m68k/lib/gcc/m68k-elf/7.2.0/include-fixed
 /opt/toolchains/m68k/lib/gcc/m68k-elf/7.2.0/../../../../m68k-elf/include
End of search list.
GNU C11 (GCC) version 7.2.0 (m68k-elf)
         compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version 3.1.5-p2, MPC version 1.0.3, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 46dabb81a36eef283e59c52a07bd40c1


followed by the previously-shown error message.
Comment 1 Dakotah Lambert 2017-10-02 01:23:46 UTC
Simpler failing test case:
int a,b;
void f(void) {
 a &= b;
}
Comment 2 Dakotah Lambert 2017-10-02 01:25:50 UTC
Created attachment 42272 [details]
test.c
Comment 3 Martin Liška 2017-10-02 08:27:28 UTC
Confirmed, GCC 6 and 7 also ICE.