The following is a short code fragment similar to code to be found in the open source Argyll CMS (http://www.argyllcms.com/) --- #include <stdio.h>
struct _iFile { int (*fprintf)(struct _iFile *p, const char *format, ...); }; typedef struct _iFile iFile; static int testprint(iFile *p, const char *format, ...) { }; int main(int argc, char* argv[]) { iFile p; p.fprintf = testprint; p.fprintf(&p, "%i", 123); } ----- gcc -D_FORTIFY_SOURCE=2 -O2 test.c -E | tail ----- typedef struct _iFile iFile; static int testprint(iFile *p, const char *format, ...) { }; int main(int argc, char* argv[]) { iFile p; p.fprintf = testprint; p.__fprintf_chk (&p, 2 - 1, "%i", 123); } ----- The second to last line is clearly wrong (or at least unintended) -- Summary: FORTIFY_SOURCE matches to many patterns Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stefan dot bruens at rwth-aachen dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34710