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

            Bug ID: 64663
           Summary: ICE at -O1 and above with -g enabled on
                    x86_64-linux-gnu
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

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

The ICE also affects all earlier versions of GCC since 4.6. 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-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 5.0.0 20150118 (experimental) [trunk revision 219826] (GCC) 

$ 
$ gcc-trunk -O0 -g -c small.c
$ gcc-trunk -O1 -c small.c
$ 
$ gcc-trunk -O1 -g -c small.c
small.c: In function ‘fn1’:
small.c:13:1: internal compiler error: Segmentation fault
 }
 ^
0xa9f6af crash_signal
    ../../gcc-trunk/gcc/toplev.c:381
0x736a40 decl_piece_bitsize
    ../../gcc-trunk/gcc/dwarf2out.c:5072
0x766c47 dw_sra_loc_expr
    ../../gcc-trunk/gcc/dwarf2out.c:13943
0x7673e0 dw_loc_list
    ../../gcc-trunk/gcc/dwarf2out.c:14118
0x7673e0 loc_list_from_tree
    ../../gcc-trunk/gcc/dwarf2out.c:14562
0x76c5c3 add_location_or_const_value_attribute
    ../../gcc-trunk/gcc/dwarf2out.c:16070
0x753250 gen_variable_die
    ../../gcc-trunk/gcc/dwarf2out.c:19240
0x754ef9 gen_decl_die
    ../../gcc-trunk/gcc/dwarf2out.c:20969
0x7566a4 process_scope_var
    ../../gcc-trunk/gcc/dwarf2out.c:20484
0x756877 decls_for_scope
    ../../gcc-trunk/gcc/dwarf2out.c:20509
0x756f6a gen_subprogram_die
    ../../gcc-trunk/gcc/dwarf2out.c:18832
0x754f69 gen_decl_die
    ../../gcc-trunk/gcc/dwarf2out.c:20902
0x755f9c dwarf2out_decl
    ../../gcc-trunk/gcc/dwarf2out.c:21335
0x75636e dwarf2out_function_decl
    ../../gcc-trunk/gcc/dwarf2out.c:21343
0x7c2dd4 rest_of_handle_final
    ../../gcc-trunk/gcc/final.c:4521
0x7c2dd4 execute
    ../../gcc-trunk/gcc/final.c:4563
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;

void
fn1 ()
{
  int c[9] = { 0 };
  for (;;)
    {
      a = (int) 3655990292 % 9;
      if (b && c[a])
    c[a] = 0;
    }
}

Reply via email to