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

            Bug ID: 64882
           Summary: ICE on valid code at -O3 with -g enabled in
                    simplify_subreg, at simplify-rtx.c:5681
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          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
-O3 with -g enabled on x86_64-linux-gnu in the 64-bit mode (but not in 32-bit
mode). 

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 20150130 (experimental) [trunk revision 220273] (GCC) 
$ 
$ gcc-trunk -O3 -c small.c
$ gcc-trunk -O2 -g -c small.c
$ gcc-4.9 -O3 -g -c small.c
$ 
$ gcc-trunk -O3 -g -c small.c
small.c: In function ‘fn3’:
small.c:27:1: internal compiler error: in simplify_subreg, at
simplify-rtx.c:5681
 }
 ^
0xa6a4d5 simplify_subreg(machine_mode, rtx_def*, machine_mode, unsigned int)
    ../../gcc-trunk/gcc/simplify-rtx.c:5681
0xa6b359 simplify_gen_subreg(machine_mode, rtx_def*, machine_mode, unsigned
int)
    ../../gcc-trunk/gcc/simplify-rtx.c:5901
0xd1cc07 vt_expand_loc_callback
    ../../gcc-trunk/gcc/var-tracking.c:8415
0x6fca51 cselib_expand_value_rtx_1
    ../../gcc-trunk/gcc/cselib.c:1669
0x6fde1e 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
0xd1ced5 vt_expand_var_loc_chain
    ../../gcc-trunk/gcc/var-tracking.c:8310
0xd1ced5 vt_expand_loc_callback
    ../../gcc-trunk/gcc/var-tracking.c:8472
0x6fcaf2 cselib_expand_value_rtx_1
    ../../gcc-trunk/gcc/cselib.c:1704
0x6fde1e 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
0xd1ced5 vt_expand_var_loc_chain
    ../../gcc-trunk/gcc/var-tracking.c:8310
0xd1ced5 vt_expand_loc_callback
    ../../gcc-trunk/gcc/var-tracking.c:8472
0x6fc90c cselib_expand_value_rtx_1
    ../../gcc-trunk/gcc/cselib.c:1742
0x6fde1e 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
0xd1ced5 vt_expand_var_loc_chain
    ../../gcc-trunk/gcc/var-tracking.c:8310
0xd1ced5 vt_expand_loc_callback
    ../../gcc-trunk/gcc/var-tracking.c:8472
0x6fcaf2 cselib_expand_value_rtx_1
    ../../gcc-trunk/gcc/cselib.c:1704
0x6fde1e 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
0xd1ced5 vt_expand_var_loc_chain
    ../../gcc-trunk/gcc/var-tracking.c:8310
0xd1ced5 vt_expand_loc_callback
    ../../gcc-trunk/gcc/var-tracking.c:8472
0x6fde1e 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
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, d, e;
long b;
static long *c = &b;

void fn1 (short p) { }

long
fn2 (long p1, long p2)
{
  return (p1 && p1 > 26854775807 - p2) || p1 < -p2 ? p1 : p1 + p2;
}

void
fn3 ()
{
  long f;
  int g = 3;
  int *h = &a;
  for (e = 0; e < 2; e++)
    {
      int *i = &g;
      if (!fn2 (*c, 7 < d % (*i)--))
    f = fn2 ((*h <= 0) | b, 5278350700);
      *h = f;
      fn1 (*h);
    }
}

Reply via email to