https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69802

            Bug ID: 69802
           Summary: gcc ICE at -O1 and above  on valid code on
                    x86_64-linux-gnu with “seg fault”
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

The following valid code causes an ICE when compiled with the current gcc trunk
at -O1 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes.

It might be a regression from 4.7.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160212 (experimental) [trunk revision 233377] (GCC)




$ gcc-trunk abc.c -c -O3
abc.c: In function 'fn1':
abc.c:5:5: internal compiler error: Segmentation fault
 int fn1() {
     ^~~
0xb5df2f crash_signal
        ../../gcc/gcc/toplev.c:335
0x8d12c9 bb_seq_addr
        ../../gcc/gcc/gimple.h:1654
0x8d12c9 gsi_start_bb
        ../../gcc/gcc/gimple-iterator.h:129
0x8d12c9 gsi_for_stmt(gimple*)
        ../../gcc/gcc/gimple-iterator.c:617
0xcf4a27 update_range_test
        ../../gcc/gcc/tree-ssa-reassoc.c:2099
0xcfc178 optimize_range_tests
        ../../gcc/gcc/tree-ssa-reassoc.c:2638
0xd0034d reassociate_bb
        ../../gcc/gcc/tree-ssa-reassoc.c:4882
0xcfffb7 reassociate_bb
        ../../gcc/gcc/tree-ssa-reassoc.c:4960
0xd026ba do_reassoc
        ../../gcc/gcc/tree-ssa-reassoc.c:5074
0xd026ba execute_reassoc
        ../../gcc/gcc/tree-ssa-reassoc.c:5161
0xd026ba execute
        ../../gcc/gcc/tree-ssa-reassoc.c:5200
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


$ cat abc.c
struct S {
  unsigned f1 : 1;
};
int d, a;
int fn1() {
  unsigned b = 0;
  struct S c;
  d = ((1 && b) < c.f1) & c.f1;
  return a;
}

Reply via email to