[Bug middle-end/54582] gap in FORTIFY checking of buffer lengths
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 6 13:47:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54582
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-06 13:46:05 UTC ---
1) this is -D_FORTIFY_SOURCE warning, you can invent other warnings elsewhere
2) with -D_FORTIFY_SOURCE, e.g. sprintf is an inline function, so the FE sees
it as a call to an inline function with some argument, you need to inline it,
figure out what the inline does, then fold the builtins used in the inline.
Also consider
char buf[2];
char *p;
p = buf;
sprintf(buf, "ab%d", n);
Unless you move the optimization passes into the FE, you aren't going to warn
about this properly in the FE. Insisting on a FE warning in this case is just
dumb.
More information about the Gcc-bugs
mailing list