Andrew MacLeod <amacl...@redhat.com> writes:

> There is a bug in irange::set_range_from_bitmask where if the bitmask
> indicated the result is a singleton, it would simply return that
> singleton.  It never actually checked to see if that singleton was
> actually contained in the range, in which case it should return
> UNDEFINED.
>
> I haven't been able to reproduce this in the wild, but my upcoming
> switch changes triggered this problem. As a result, im not sure this
> need to be backported...  but I leave that to the maintainers.  It
> should be harmless to backport to gcc15 and/or gcc 14. the situation
> was

FWIW, I spent time debugging & reporting a switch range issue before
that was already fixed on trunk (PR117100), so a backport unless you see
a problem would be welcome. These things often show up when you don't
expect it.

>
> a = a & 0xF0
> switch (a)
>   {
>      case 24 ... 28:
>  }
>
> was being rewritten by the new code to
>
>  case 16:
>
> which is blatantly wrong.  With the proper UNDEFINED result, the case
> will be eliminated.   Again, this situation is does not exist prior to
> the next set of patches.
>
> Bootstrapped on 86_64-pc-linux-gnu with no regressions.  Pushed
>
> Andrew
>
> [2. text/x-patch; 
> 0001-Check-if-constant-is-a-member-before-returning-it.patch]...

Reply via email to