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

            Bug ID: 61684
           Summary: ICE at -Os and above on x86_64-linux-gnu in tree
                    check: expected ssa_name, have addr_expr in
                    recognize_single_bit_test, at tree-ssa-ifcombine.c:238
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-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
-Os and above on x86_64-linux-gnu in 32-bit mode (but not in 64-bit mode). 

It 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/4.10.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 4.10.0 20140702 (experimental) [trunk revision 212229] (GCC) 
$ 
$ gcc-trunk -m32 -O1 -c small.c
$ gcc-trunk -m64 -Os -c small.c
$ gcc-4.9 -m32 -Os -c small.c
$ 
$ gcc-trunk -m32 -Os small.c
small.c: In function ‘foo’:
small.c:7:1: internal compiler error: tree check: expected ssa_name, have
addr_expr in recognize_single_bit_test, at tree-ssa-ifcombine.c:238
 foo ()
 ^
0xbc3ef4 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
    ../../gcc-trunk/gcc/tree.c:9220
0xa93780 tree_check(tree_node*, char const*, int, char const*, tree_code)
    ../../gcc-trunk/gcc/tree.h:2731
0xa93780 recognize_single_bit_test
    ../../gcc-trunk/gcc/tree-ssa-ifcombine.c:238
0xa938cb ifcombine_ifandif
    ../../gcc-trunk/gcc/tree-ssa-ifcombine.c:361
0xa95c6d tree_ssa_ifcombine_bb_1
    ../../gcc-trunk/gcc/tree-ssa-ifcombine.c:607
0xa95e30 tree_ssa_ifcombine_bb
    ../../gcc-trunk/gcc/tree-ssa-ifcombine.c:695
0xa95e30 execute
    ../../gcc-trunk/gcc/tree-ssa-ifcombine.c:783
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, c;
static int *b = 0;
short d;
static short **e = 0;

void
foo ()
{
  for (; c < 1; c++)
    ;
  *e = &d;
  a = d && (c && 1) & *b;
}

Reply via email to