https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109979
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Summary|[12 Regression] |-Wformat-overflow false |-Wformat-overflow false |positive for %d and |positive for %d and |non-basic expression |non-basic expression | --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The warning happens in GCC 8+ with -O1 and above too ... Really the warning should have happened for the first sprintf too because even though e has no range, it still can overflow the buffer.