This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/38902] __builtin_strcpy doesn't work with -fstack-protector
- From: "hjl dot tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jan 2009 01:43:28 -0000
- Subject: [Bug target/38902] __builtin_strcpy doesn't work with -fstack-protector
- References: <bug-38902-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from hjl dot tools at gmail dot com 2009-01-18 01:43 -------
bash-3.2$ cat /tmp/x.c
extern void abort ();
int foo (const char *, const char *);
int main (void)
{
char buffer[1024]="";
__builtin_strcpy (buffer, "1234567890abcdefghijklmno");
if (foo (buffer, "1234567890abcdefghijklmno"))
abort ();
}
bash-3.2$ cat /tmp/y.c
int
foo (const char *x , const char * y)
{
return __builtin_strcmp (x, y);
}
bash-3.2$ ./xgcc -B./ -O2 -m32 -c /tmp/y.c
bash-3.2$ ./xgcc -B./ -O2 -m32 -O2 -fstack-protector /tmp/x.c -c
bash-3.2$ ./xgcc -B./ -m32 x.o y.o
bash-3.2$ ./a.out
Aborted
bash-3.2$
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38902