http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49720

           Summary: Infinite recursion compiling gold binary_test.cc
                    testcase
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: r...@gcc.gnu.org
              Host: i386-pc-solaris2.11
            Target: i386-pc-solaris2.11
             Build: i386-pc-solaris2.11


While compiling the gold testcast binary_test.cc, cc1plus SEGVed:

$ cc1plus -O2 sgr.ii
 int main()
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <early_local_cleanups> <whole-program>
<profile_estimate> <cp> <inline> <pure-const> <static-var>Assembling functions:
 int main()Segmentation Fault

In gdb, I find that there's either a deep (depth > 22000) or infinite recursion
in simplify_gen_relational:

#0  0x084c220d in swap_commutative_operands_p (x=0xfed6a1d0, y=0xfed6a200)
    at /vol/gcc/src/hg/trunk/local/gcc/rtlanal.c:3111
#1  0x084ea80a in simplify_binary_operation (code=PLUS, mode=SImode, 
    op0=0xfed6a1d0, op1=0xfed6a200)
    at /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:1899
#2  0x084f0d4f in simplify_plus_minus (code=Unhandled dwarf expression opcode
0xf3
)
    at /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:4064
#3  0x084eb7f9 in simplify_binary_operation_1 (code=MINUS, mode=SImode, 
    op0=0xfd41966c, op1=0xfed6a1d0)
    at /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:2308
#4  simplify_binary_operation (code=MINUS, mode=SImode, op0=0xfd41966c, 
    op1=0xfed6a1d0) at /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:1910
#5  0x084f5d88 in simplify_const_relational_operation (code=EQ, mode=SImode, 
    op0=0xfd41966c, op1=<value optimized out>)
    at /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:4559
#6  0x084e9f5e in simplify_relational_operation (code=EQ, mode=CCZmode, 
    cmp_mode=SImode, op0=0xfed6a1d0, op1=0xfd41966c)
    at /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:4184
#7  0x084ea736 in simplify_gen_relational (code=EQ, mode=CCZmode, 
    cmp_mode=SImode, op0=0xfed6a1d0, op1=0xfd41966c)
    at /vol/gcc/src/hg/trunk/local/gcc/simplify-rtx.c:401
#8  0x084ea736 in simplify_gen_relational (code=EQ, mode=CCZmode, 
    cmp_mode=SImode, op0=0xfed6a1f0, op1=0xfd419660)

Here's the simplified testcase:

extern char t_start[], t_end[], t_size[];
int
main(void)
{
  int size = reinterpret_cast<int>(t_size);
  return (size == t_end - t_start);
}

Reply via email to