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

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #6)
> No, it diagnoses the main bug

Nope, it does not.  -Wchar-subscripts is designed and documented to diagnose a
common cause of a bug.  The actual bug itself (which, as noted in pr94182, the
manual neglects to describe) is in inadvertently using a negative index as a
result of sign extension when a positive index is intended.  When that cannot
happen there is obviously no bug to diagnose.

There's no doubt that there is room for improvement in both warnings.  Some of
the false negatives might be avoidable by enhancing -Wchar-subscripts in the
front-end (e.g., fixing the remainder of pr29455), but the better ROI is in
continuing to improve -Warray-bounds (pr56456).

Reply via email to