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

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Filip Kastl from comment #10) 
> I thought that switch lowering shouldn't run into empty switches (can't
> recall what made me think that though).  I'll look into why that happens.

Well before switch lowering you won't have an empty switch, but ...
Take:
```
<L9>:
  switch (b.0_1) <default: <L7> [0.00%], case 5: <L6> [100.00%], case 101: <L6>
[100.00%]>
;;    succ:       5 [never]  count:0 (precise, freq 0.0000) (EXECUTABLE)
;;                4 [always]  count:0 (precise, freq 0.0000) (EXECUTABLE)

;;   basic block 4, loop depth 0, count 0 (precise, freq 0.0000), probably
never executed
;;    prev block 3, next block 5, flags: (NEW, REACHABLE, VISITED)
;;    pred:       3 [always]  count:0 (precise, freq 0.0000) (EXECUTABLE)
<L6>:
  __builtin_unreachableD.2065 ();
;;    succ:     


```

And switch lowering removes the unreachable block and the 2 case statements
(5/101). So we end up with just a default. And then the assert happens.

Reply via email to