This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/34710] New: FORTIFY_SOURCE matches to many patterns
- From: "stefan dot bruens at rwth-aachen dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Jan 2008 23:40:04 -0000
- Subject: [Bug c/34710] New: FORTIFY_SOURCE matches to many patterns
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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