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

            Bug ID: 70110
           Summary: ICE at -O3 in the 32-bit mode in set_last_insn, at
                    emit-rtl.h:420
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk on
x86_64-linux-gnu at -O3 in the 32-bit mode (but not in 64-bit mode). 

This is a regression from 5.3.x. 


$ 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 20160306 (experimental) [trunk revision 234012] (GCC) 
$ 
$ gcc-trunk -m32 -O2 -c small.c
$ gcc-trunk -m64 -O3 -c small.c
$ gcc-5.3 -m32 -O3 -c small.c
$ 
$ gcc-trunk -m32 -O3 -c small.c
small.c: In function ‘fn3’:
small.c:36:1: internal compiler error: in set_last_insn, at emit-rtl.h:420
 }
 ^
0x5b4c2d set_last_insn
        ../../gcc-source-trunk/gcc/emit-rtl.h:420
0x81a309 set_last_insn
        ../../gcc-source-trunk/gcc/rtl.h:844
0x81a309 end_sequence()
        ../../gcc-source-trunk/gcc/emit-rtl.c:5442
0xeb451a scalar_chain::make_vector_copies(unsigned int)
        ../../gcc-source-trunk/gcc/config/i386/i386.c:3276
0xeb5009 scalar_chain::convert()
        ../../gcc-source-trunk/gcc/config/i386/i386.c:3512
0xeb58b4 convert_scalars_to_vector
        ../../gcc-source-trunk/gcc/config/i386/i386.c:3577
0xeb58b4 execute
        ../../gcc-source-trunk/gcc/config/i386/i386.c:3669
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, c, d, f, h;
long long b;

int
fn1 ()
{
  if (a) 
    fn1 ();
  b = c;
  return 0;
}

void 
fn2 (int p)
{
  if (p)
    f = 0; 
  b |= c; 
} 

void
fn3 ()
{
  b = d;
  for (; (d = 1);)
    {
      int g, i;
      a && fn1 ();
      b |= c;
      fn2 (h); 
      fn2 (g); 
      fn2 (h); 
      fn2 (i); 
      fn2 (h);
    }
}

int
main ()
{
  return 0; 
}

Reply via email to