[Bug c/94247] Wrong char-subscripts warning for limited-range index

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 23 18:41:55 GMT 2020


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

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

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #5)
> -Wchar-subscripts is far too primitive of an instrument to rely on to detect
> real bugs with any fidelity.

No, it diagnoses the main bug, that one uses char as index type, which isn't
very portable.  If one uses explicit signed char or unsigned char, it will
behave the same way on all targets, but char will not (unless it has values
from 0 to SCHAR_MAX only).


More information about the Gcc-bugs mailing list