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

            Bug ID: 65321
           Summary: ICE on valid code at -O2 and -O3 with -g enabled in
                    decompose, at rtl.h:2007
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          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
-O2 and -O3 with -g enabled on x86_64-linux-gnu in both 32-bit and 64-bit
modes.

This is a regression from 4.9.x.


$ 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 20150304 (experimental) [trunk revision 221192] (GCC) 
$ 
$ gcc-trunk -O2 -c small.c
$ gcc-4.9.2 -O2 -g -c small.c
$ 
$ gcc-trunk -O2 -g -c small.c
small.c: In function ‘fn1’:
small.c:27:1: internal compiler error: in decompose, at rtl.h:2007
 }
 ^
0xae1a87 wi::int_traits<std::pair<rtx_def*, machine_mode> >::decompose(long*,
unsigned int, std::pair<rtx_def*, machine_mode> const&)
    ../../gcc-trunk/gcc/rtl.h:2005
0xae1a87 wide_int_ref_storage<false>::wide_int_ref_storage<std::pair<rtx_def*,
machine_mode> >(std::pair<rtx_def*, machine_mode> const&, unsigned int)
    ../../gcc-trunk/gcc/wide-int.h:957
0xae1a87 generic_wide_int<wide_int_ref_storage<false>
>::generic_wide_int<std::pair<rtx_def*, machine_mode> >(std::pair<rtx_def*,
machine_mode> const&, unsigned int)
    ../../gcc-trunk/gcc/wide-int.h:733
0xae1a87 wi::binary_traits<std::pair<rtx_def*, machine_mode>,
std::pair<rtx_def*, machine_mode>, wi::int_traits<std::pair<rtx_def*,
machine_mode> >::precision_type, wi::int_traits<std::pair<rtx_def*,
machine_mode> >::precision_type>::result_type wi::sub<std::pair<rtx_def*,
machine_mode>, std::pair<rtx_def*, machine_mode> >(std::pair<rtx_def*,
machine_mode> const&, std::pair<rtx_def*, machine_mode> const&)
    ../../gcc-trunk/gcc/wide-int.h:2357
0xae1a87 simplify_const_binary_operation(rtx_code, machine_mode, rtx_def*,
rtx_def*)
    ../../gcc-trunk/gcc/simplify-rtx.c:3934
0xaded4f simplify_binary_operation(rtx_code, machine_mode, rtx_def*, rtx_def*)
    ../../gcc-trunk/gcc/simplify-rtx.c:1987
0x7791f3 cselib_expand_value_rtx_1
    ../../gcc-trunk/gcc/cselib.c:1843
0x77a38e cselib_expand_value_rtx_cb(rtx_def*, bitmap_head*, int, rtx_def*
(*)(rtx_def*, bitmap_head*, int, void*), void*)
    ../../gcc-trunk/gcc/cselib.c:1551
0xd88005 vt_expand_var_loc_chain
    ../../gcc-trunk/gcc/var-tracking.c:8310
0xd88005 vt_expand_loc_callback
    ../../gcc-trunk/gcc/var-tracking.c:8472
0x779102 cselib_expand_value_rtx_1
    ../../gcc-trunk/gcc/cselib.c:1704
0x77a38e cselib_expand_value_rtx_cb(rtx_def*, bitmap_head*, int, rtx_def*
(*)(rtx_def*, bitmap_head*, int, void*), void*)
    ../../gcc-trunk/gcc/cselib.c:1551
0xd88bb1 vt_expand_var_loc_chain
    ../../gcc-trunk/gcc/var-tracking.c:8310
0xd88bb1 vt_expand_1pvar
    ../../gcc-trunk/gcc/var-tracking.c:8585
0xd88bb1 emit_note_insn_var_location(variable_def**, emit_note_data_def*)
    ../../gcc-trunk/gcc/var-tracking.c:8640
0xd92403 void hash_table<variable_hasher, xcallocator,
false>::traverse_noresize<emit_note_data_def*,
&(emit_note_insn_var_location(variable_def**,
emit_note_data_def*))>(emit_note_data_def*)
    ../../gcc-trunk/gcc/hash-table.h:1057
0xd92403 void hash_table<variable_hasher, xcallocator,
false>::traverse<emit_note_data_def*,
&(emit_note_insn_var_location(variable_def**,
emit_note_data_def*))>(emit_note_data_def*)
    ../../gcc-trunk/gcc/hash-table.h:1079
0xd92403 emit_notes_for_changes
    ../../gcc-trunk/gcc/var-tracking.c:9000
0xd94140 emit_notes_in_bb
    ../../gcc-trunk/gcc/var-tracking.c:9432
0xd94140 vt_emit_notes
    ../../gcc-trunk/gcc/var-tracking.c:9495
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, c, d, e;

int
fn1 ()
{
  int h;
  char i;
  for (; c > 0;)
    {
      for (d = 0; d < 2; d++)
    {
      i = 1 << d;
      if (i - a)
        {
          e = b = 0;
          for (; c; c--)
        d = 127;
        }
    }
      h = ~d;
      if (h > c)
    for (;;)
      ;
      return 0;
    }
  return 0;
}

Reply via email to