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

--- Comment #2 from Heiko Eißfeldt <heiko at hexco dot de> ---
For this testcase (which ICEs with trunk)
```
/* PR middle-end/114541 */
/* { dg-do compile } */
/* { dg-options "-fgimple" } */
/* { dg-bogus "internal compiler error" } */

void __GIMPLE (ssa,startwith ("dse2")) foo ()
{
  int a;

__BB(2):
  if (a_5(D) > 4)
    goto __BB3&; /* { dg-error "expected ';' before" } */
  else
    goto __BB4;

__BB(3):
  a_2 = 10;
  goto __BB5;

__BB(4):
  a_3 = 20;
  goto __BB5;

__BB(5):
  a_1 = __PHI (__BB3: a_2, __BB4: a_3);
  a_4 = a_1 + 4;

return;
}
```
I have a patch that avoids the ICE (and a similar one with goto __BB4&).

But after fixing the atoi() with strtoul() in c_parser_gimple_parse_bb_spec()
the original testcase from the description becomes acceptable in
c_parser_gimple_if_stmt() because when __BB# is not detected as a building
block number it is considered to be a _label_ (as a fallback).
```
      if ((cfun->curr_properties & PROP_cfg)
          && c_parser_gimple_parse_bb_spec_edge_probability (label, parser,
                                                             &dest_index,
&prob))
        parser.push_edge (parser.current_bb->index, dest_index,
                          EDGE_TRUE_VALUE, prob);
      else
        t_label = lookup_label_for_goto (loc, label);
```

Later on in c_parser_parse_gimple_body() when constructing CFG, edges and
dominance info only building block numbers are expected (i think).

So, how should the label case be handled, if at all?
This is a bit above my pay grade, so any enlightenment would be welcome.

Reply via email to