https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92507
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So there are two things here. First -Wsign-compare does not understand flow control at all so it only looks at the statement/expression at hand (i < n). Second n is not a constant integer expression in C (It is in C++ but that is a different langauge).