use '-O2 -finline-functions -ftracer -floop-optimize2' to reproduce:
----------------------------------------------------------------------------------------
extern void fancy_abort (void) __attribute__ ((__noreturn__));

int
reverse_condition (int code)
{
  switch (code)
    {
    case 4:
      return 3;
    case 3:
      return 4;
    case 6:
      return 7;
    case 7:
      return 8;
    case 8:
      return 5;
    case 5:
      return 6;

    default:
      fancy_abort ();
    }
}

int
reversed_comparison_code_parts (int code, int code2)
{
  switch (code)
    {
    case 4:
    case 3:
      return reverse_condition (code);
    }

  if (code2 == 1)
    return reverse_condition (code);

  return 0;
}
----------------------------------------------------------------------------------------
backtrace:

Program received signal SIGSEGV, Segmentation fault.
try_crossjump_to_edge (mode=19, e1=0x7, e2=0x40219a08) at
../../gcc/gcc/cfgcleanup.c:1637
1637          s->count += s2->count;
(gdb) bt
#0  try_crossjump_to_edge (mode=19, e1=0x7, e2=0x40219a08) at
../../gcc/gcc/cfgcleanup.c:1637
#1  0x08178cfa in try_crossjump_bb (mode=19, bb=0x4021acb0) at
../../gcc/gcc/cfgcleanup.c:1810
#2  0x08179acc in cleanup_cfg (mode=19) at ../../gcc/gcc/cfgcleanup.c:1997
#3  0x083b8127 in rest_of_handle_flow2 () at ../../gcc/gcc/passes.c:1322
#4  0x083b8b20 in rest_of_compilation () at ../../gcc/gcc/passes.c:1728
#5  0x080c91aa in execute_pass_list (pass=0x852ba80) at
../../gcc/gcc/tree-optimize.c:516
#6  0x080c93f1 in tree_rest_of_compilation (fndecl=0x4020f244)
    at ../../gcc/gcc/tree-optimize.c:652
#7  0x080615d1 in c_expand_body (fndecl=0x4020f244) at 
../../gcc/gcc/c-decl.c:6387
#8  0x083e1167 in cgraph_expand_function (node=0x4020f4fc) at
../../gcc/gcc/cgraphunit.c:822
#9  0x083e1e8b in cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1689
#10 0x0838fa67 in toplev_main (argc=1075931488, argv=0x85d1498) at
../../gcc/gcc/toplev.c:1005
#11 0x080a7bae in main (argc=1075931488, argv=0x40216960) at 
../../gcc/gcc/main.c:35

-- 
           Summary: [4.0 Regression] ICE Segmentation fault in
                    try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: belyshev at lubercy dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to