https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79082
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- I see no warning at -O0 on snprintf (buffer, 4, "%03hx", val & 0xfff); or at -O2 on: snprintf (buffer, 3, "%2d", (val < 0) ? -(val % 100) : val % 100); (It does warn at -O0 as expected.) This is on x86_64 (both ILP32 and LP64) but there are known issues in VRP that have been seen to lead to false positives. What target are you seeing false positives on and with what revision?