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

            Bug ID: 66733
           Summary: ICE at -Os and above on x86_64-linux-gnu
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-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
-Os and above on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

It 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 20150701 (experimental) [trunk revision 225222] (GCC) 
$ 
$ gcc-trunk -O1 -c small.c
$ gcc-5.1 -Os -c small.c
$ 
$ gcc-trunk -Os -c small.c
small.c: In function ‘fn2’:
small.c:26:1: internal compiler error: Segmentation fault
 }
 ^
0xb339cf crash_signal
        ../../gcc-trunk/gcc/toplev.c:360
0x83d94d fold_comparison
        ../../gcc-trunk/gcc/fold-const.c:8807
0x81dec9 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        ../../gcc-trunk/gcc/fold-const.c:11922
0xb7b2c4 cleanup_control_expr_graph
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:128
0xb7b2c4 cleanup_control_flow_bb
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:223
0xb7b2c4 cleanup_tree_cfg_bb
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:640
0xb7b8e8 cleanup_tree_cfg_1
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:693
0xb7b8e8 cleanup_tree_cfg_noloop
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:745
0xb7b8e8 cleanup_tree_cfg()
        ../../gcc-trunk/gcc/tree-cfgcleanup.c:800
0xa6ffe4 execute_function_todo
        ../../gcc-trunk/gcc/passes.c:1910
0xa70883 execute_todo
        ../../gcc-trunk/gcc/passes.c:2014
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;

int
fn1 ()
{
  return 1;
}

void
fn2 ()
{
  int b, j;
  for (;;)
    {
      int c = 1;
      if (j)
        {
          if (c)
            break;
        }
      else
        b = a;
      fn1 () && b;
      j = fn1 ();
    }
}

Reply via email to