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

            Bug ID: 66168
           Summary: ICE at -O3 in elimination_costs_in_insn, at
                    reload1.c:3677
           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 at
-O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes.

This is a regression from 5.1.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/6.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 6.0.0 20150515 (experimental) [trunk revision 223211] (GCC) 
$ 
$ gcc-trunk -O2 -c small.c 
$ gcc-5.1 -O3 -c small.c
$ 
$ gcc-trunk -O3 -c small.c
small.c: In function ‘fn1’:
small.c:15:1: internal compiler error: in elimination_costs_in_insn, at
reload1.c:3677
 }
 ^
0xa660dc elimination_costs_in_insn
        ../../gcc-trunk/gcc/reload1.c:3674
0xa669aa calculate_elim_costs_all_insns()
        ../../gcc-trunk/gcc/reload1.c:1671
0x95637e ira_costs()
        ../../gcc-trunk/gcc/ira-costs.c:2238
0x9503c6 ira_build()
        ../../gcc-trunk/gcc/ira-build.c:3459
0x948714 ira
        ../../gcc-trunk/gcc/ira.c:5253
0x948714 execute
        ../../gcc-trunk/gcc/ira.c:5545
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 ()
{
  for (;;)
    {
      for (b = 0; b < 3; b++)
        {
          char e[2];
          char f = e[1];
          a ^= f ? 1 / f : 0; 
        }
    }
}

Reply via email to