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

            Bug ID: 70263
           Summary: ICE at -O1 and above in both 32-bit and 64-bit modes
                    on x86_64-linux-gnu (segmentation fault)
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code crashes the trunk of gcc at -O1 and above in both 32-bit and
64-bit modes on x86_64-linux-gnu. 

This bug also affects gcc-4.9 and later versions. 


$: 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/6.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 6.0.0 20160316 (experimental) [trunk revision 234258] (GCC) 
$: 
$: gcc-trunk -O1 small.c
small.c: In function ‘fn1’:
small.c:10:1: internal compiler error: Segmentation fault
 }
 ^
0xb520ff crash_signal
        ../../gcc-source-trunk/gcc/toplev.c:335
0x996b1d memref_used_between_p
        ../../gcc-source-trunk/gcc/ira.c:3237
0x996b1d update_equiv_regs
        ../../gcc-source-trunk/gcc/ira.c:3654
0x998293 ira
        ../../gcc-source-trunk/gcc/ira.c:5219
0x998293 execute
        ../../gcc-source-trunk/gcc/ira.c:5549
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 small.c
int a[91];
int b, c;
void fn1() {
  int n, m;
  do {
    a[c--];
    a[--c] = m;
    a[--m] = b;
  } while (n);
}

int main() {}
$:

Reply via email to