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

            Bug ID: 71410
           Summary: ICE on valid code at -O3 on x86_64-linux-gnu:
                    Segmentation fault
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

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

It is a regression from 6.1.x. 

This is likely related to PR 71366, which has been fixed. 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160603 (experimental) [trunk revision 237075] (GCC) 
$ 
$ gcc-trunk -O2 -c small.c
$ gcc-6.1 -O3 -c small.c
$ 
$ gcc-trunk -O3 -c small.c
small.c: In function ‘fn1’:
small.c:4:1: internal compiler error: Segmentation fault
 fn1 ()
 ^~~
0xbbeaaf crash_signal
        ../../gcc-source-trunk/gcc/toplev.c:333
0x789944 find_edge(basic_block_def*, basic_block_def*)
        ../../gcc-source-trunk/gcc/cfganal.c:506
0xd07431 unloop_loops
        ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:633
0xd0a6e2 tree_unroll_loops_completely(bool, bool)
        ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1379
0xd0a893 execute
        ../../gcc-source-trunk/gcc/tree-ssa-loop-ivcanon.c:1587
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.
$ 


------------------------------------------


int a, b[40];

int 
fn1 ()
{
  for (;;)
    {
      int c, d; 
      for (c = 0; c < 5; c++)
        {
          for (;;)
            {
              if (b[(c + 1) * 8])
                break;
              return a;
            }
          a = a || b[0];
        }
      for (d = 0; d < 1; d++)
        a = 0;
    }
}

Reply via email to