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

            Bug ID: 68909
           Summary: ICE on valid code at -O3 on x86_64-linux-gnu in
                    maybe_record_trace_start, at dwarf2cfi.c:2297
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  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.


$: 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-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20151214 (experimental) [trunk revision 231607] (GCC) 
$: 
$: gcc-trunk -m32 -O3 small.c
small.c: In function ‘main’:
small.c:18:1: internal compiler error: in maybe_record_trace_start, at
dwarf2cfi.c:2284
 }
 ^

0x789cf6 maybe_record_trace_start
        ../../gcc-trunk/gcc/dwarf2cfi.c:2284
0x78c450 scan_trace
        ../../gcc-trunk/gcc/dwarf2cfi.c:2462
0x78cc8a create_cfi_notes
        ../../gcc-trunk/gcc/dwarf2cfi.c:2616
0x78cc8a execute_dwarf2_frame
        ../../gcc-trunk/gcc/dwarf2cfi.c:2974
0x78cc8a execute
        ../../gcc-trunk/gcc/dwarf2cfi.c:3454
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.
$: gcc-trunk -m64 -O3 small.c
small.c: In function ‘main’:
small.c:18:1: internal compiler error: in maybe_record_trace_start, at
dwarf2cfi.c:2284
 }
 ^

0x789cf6 maybe_record_trace_start
        ../../gcc-trunk/gcc/dwarf2cfi.c:2284
0x78c450 scan_trace
        ../../gcc-trunk/gcc/dwarf2cfi.c:2462
0x78cc8a create_cfi_notes
        ../../gcc-trunk/gcc/dwarf2cfi.c:2616
0x78cc8a execute_dwarf2_frame
        ../../gcc-trunk/gcc/dwarf2cfi.c:2974
0x78cc8a execute
        ../../gcc-trunk/gcc/dwarf2cfi.c:3454
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 printf(const char*, ...);
int a, b, c;
char d = 5;
int **e;
int main() {
  b = 6;
  for (; b; b--) {
    c = 0;
    for (; c <= 8; c++) {
      while (!d)
        if (*e)
          break;
      d = 1;
    }
  }
  printf("%d\n", a);
  return 0;
}
$:

Reply via email to