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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
From my understanding, the warning is correct.
You have in the code essentially:
something b[3];
unsigned int o;
...
  switch ((unsigned char) o)
    {
    case 2:
      if (o == 2)
        for (;;)
          ;
      b[o];
    }
Thus, the b[o] array access is executed only if the low 8 bits of o are 2, but
the high 24 bits of o are not 0, so whenever it is executed, it is always out
of bounds access.
The infinite loop above is the result of:
    F<int, int, H>::G::operator int*<int*>
recursing infinitely.  So, in order to avoid the warning, you either want to
test all bits of o, rather than just the low 8 bits (i.e. avoid the cast to
bd), or do something with the conversion operator.
It of course could be just something introduced through creducing.

Reply via email to