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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |15.0
   Last reconfirmed|                            |2024-11-01
            Summary|ICE: in invert, at          |[15 Regression] ICE: in
                   |value-range.cc:2165 at -O3  |invert, at
                   |with "-fno-thread-jumps"    |value-range.cc:2165 at -O3
                   |                            |with "-fno-thread-jumps"
      Known to fail|                            |15.0
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-checking,
                   |                            |needs-bisection
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
  gcc_checking_assert (!undefined_p () && !varying_p ());

  switch (b_3(D)) <default: <L2> [INV], case 0 ... 1: <L7> [INV]>



Confirmed. This is a regression but I am not 100% sure when it was introduced;
it might have been introduced when gimple_outgoing_range::calc_switch_ranges
code was introduced but I am not sure.

Also I am not 100% sure if this is a ranger issue though; it might be a latent
bug in the way forwprop handles switch and fixing up when it comes to the full
range of the case statements.

Better testcase which avoids the warning about bool in a switch.

```
int a;
void c(void);
int d(_Bool b) {
  switch (b+0) {
  case 0:
    break;
  case 1:
    break;
  default:
    c();
  }
  if (b)
    return a;
}
```

Reply via email to