[Bug target/82385] New: ICE in extract_constraint_insn, at recog.c:2213

2017-10-01 Thread vvulpes0 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82385

Bug ID: 82385
   Summary: ICE in extract_constraint_insn, at recog.c:2213
   Product: gcc
   Version: 7.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: vvulpes0 at gmail dot com
  Target Milestone: ---
Target: m68k-elf

Created attachment 42271
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42271&action=edit
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") ) [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.

[Bug target/82385] ICE in extract_constraint_insn, at recog.c:2213

2017-10-01 Thread vvulpes0 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82385

--- Comment #1 from Dakotah Lambert  ---
Simpler failing test case:
int a,b;
void f(void) {
 a &= b;
}

[Bug target/82385] ICE in extract_constraint_insn, at recog.c:2213

2017-10-01 Thread vvulpes0 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82385

Dakotah Lambert  changed:

   What|Removed |Added

  Attachment #42271|0   |1
is obsolete||

--- Comment #2 from Dakotah Lambert  ---
Created attachment 42272
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42272&action=edit
test.c

[Bug target/82420] New: ICE with -malign-int and -m68000

2017-10-03 Thread vvulpes0 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82420

Bug ID: 82420
   Summary: ICE with -malign-int and -m68000
   Product: gcc
   Version: 7.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: vvulpes0 at gmail dot com
  Target Milestone: ---
Target: m68k-elf

Created attachment 42297
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42297&action=edit
test.c

When compiling test.c with the -march=68000 and -malign-int flags, a
segmentation fault occurs.  My installed copy of 7.2.0 has limited debugging
information, but another machine with 7.1.0 installed provides:


$ m68k-elf-gcc -march=68000 -malign-int -c test.c
test.c: In function 'f':
test.c:3:4: internal compiler error: Segmentation fault
  a /= 3;
^~

0x98c6df crash_signal
../../gcc-7.1.0/gcc/toplev.c:337
0x76072e assign_temp(tree_node*, int, int)
../../gcc-7.1.0/gcc/function.c:956
0x720e51 emit_push_insn(rtx_def*, machine_mode, tree_node*, rtx_def*, unsigned
int, int, rtx_def*, int, rtx_def*, rtx_def*, int, rtx_def*, bool)
../../gcc-7.1.0/gcc/expr.c:4314
0x62f734 emit_library_call_value_1
../../gcc-7.1.0/gcc/calls.c:4841
0x63452f emit_library_call_value(rtx_def*, rtx_def*, libcall_type,
machine_mode, int, ...)
../../gcc-7.1.0/gcc/calls.c:5162
0x8be6ce expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*,
int, optab_methods)
../../gcc-7.1.0/gcc/optabs.c:1758
0x8c0cfa sign_expand_binop(machine_mode, optab_tag, optab_tag, rtx_def*,
rtx_def*, rtx_def*, int, optab_methods)
../../gcc-7.1.0/gcc/optabs.c:1888
0x712c98 expand_divmod(int, tree_code, machine_mode, rtx_def*, rtx_def*,
rtx_def*, int)
../../gcc-7.1.0/gcc/expmed.c:5052
0x727084 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc-7.1.0/gcc/expr.c:8841
0x63f85d expand_gimple_stmt_1
../../gcc-7.1.0/gcc/cfgexpand.c:3676
0x63f85d expand_gimple_stmt
../../gcc-7.1.0/gcc/cfgexpand.c:3737
0x640cb5 expand_gimple_basic_block
../../gcc-7.1.0/gcc/cfgexpand.c:5744
0x64588e execute
../../gcc-7.1.0/gcc/cfgexpand.c:6357
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


This 7.1.0 was configured with:


$ m68k-elf-gcc -v
Using built-in specs.
COLLECT_GCC=m68k-elf-gcc
COLLECT_LTO_WRAPPER=/opt/toolchains/m68k/libexec/gcc/m68k-elf/7.1.0/lto-wrapper
Target: m68k-elf
Configured with: ../gcc-7.1.0/configure --target=m68k-elf
--program-prefix=m68k-elf- --prefix=/opt/toolchains/m68k
--with-local-prefix=/opt/toolchains/m68k --with-newlib --enable-languages=c,c++
--disabel-nls --disable-werror --enable-threads=single --disable-libssp
--disable-libquadmath --with-cpu=68000 --with-arch=m68k
Thread model: single
gcc version 7.1.0 (GCC)


The error persists if "-march=68000" is replaced by "-march=68010", but
disappears for values of "68020" and above.  This is presumably because the
higher versions have (multiplication and) division instructions that operate on
and produce wider types than the originals.