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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the missed optimization in GCC 14 is causing the warning NOT to show up in
the original example. Once the optimization is done (via the `if (jbeg == jend)
__builtin_unreachable()`), it shows up in GCC 12-14 too. 

>From what I can tell about the false positive it comes from:
```
  <bb 9> [local count: 118111600]:
  _15 = listJets.D.32189._M_impl._M_node.D.14392._M_next;
  if (&MEM[(struct _List_node_header *)&listJets].D.14392 != _15)
    goto <bb 10>; [89.00%]
  else
    goto <bb 17>; [11.00%]
```

Which implies it is checking that is the list is non empty.
But it looks like there is a missed optimization where _M_next here.

Reply via email to