https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92507
--- Comment #2 from David Brown <david at westcontrol dot com> --- I am aware that "n" here is not a constant integer expression - it should not need to be for a compiler warning. What the compiler needs in order to eliminate the false positive is a knowledge of the ranges of "i" and "n" here - that they are both within the common overlap between "int" and "unsigned int". I don't know if the compiler has such range information available at the time the -Wsign-compare warning is checked. If it does not, then I can see this issue being difficult to fix.