https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94247
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #7) > (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. Yes and no. Let's look at it a different way. negative index is not the issue. But rather knowing if char is signed or unsigned is the issue. it is a portability issue. -Wchar-subscripts is designed to diagnostic that you use char in a subscript as you might not know if it is signed or unsigned because the ABI differences. Look at PowerPC or ARM ABIs, you will notice that char is unsigned while other ABIs, char is signed. YES with the code in comment #0, there would be no difference but having a false negative is fine. Not all warnings are going to be 100% because of the heurstics. Since the false negative is easy workarounded, just use signed char or unsigned char or int as the loop variable. char is a special type as I keep on mentioning.