public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/50460] [4.7 Regression] __builtin___strcpy_chk/__builtin_object_size don't work Date: Mon, 26 Sep 2011 09:14:00 -0000 [thread overview] Message-ID: <bug-50460-4-g0Q8uGTAwC@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-50460-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50460 --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-09-26 09:08:36 UTC --- #define strcpy(x,y) __builtin___strcpy_chk (x, y, __builtin_object_size (x, 1)) int f1 (void) { struct A { char buf1[9]; char buf2[4]; } a; strcpy (a.buf1 + 9, "a"); return 0; } int f2 (void) { struct A { char buf1[9]; char buf2[4]; } a; strcpy (a.buf2 + 0, "a"); return 0; } int f3 (void) { struct A { char buf1[9]; char buf2[4]; } a; strcpy (a.buf1 + 10, "a"); return 0; } int f4 (void) { struct A { char buf1[9]; char buf2[4]; } a; strcpy (a.buf2 - 1, "a"); return 0; } int f5 (void) { struct A { char buf1[9]; char buf2[4]; } a; strcpy ((char *) &a + 10, "a"); return 0; } int f6 (void) { struct A { char buf1[9]; char buf2[4]; } a; strcpy ((char *) a.buf2 - 1, "a"); return 0; } used to warn in f{1,3,4,6} (and fail at runtime) and not in f{2,5} in 4.{1,2,3,4,6} (haven't checked 4.5), doesn't warn nor fail on the trunk. So yes, 4.0+ clearly did some reconstruction, but only in limited cases (e.g. when the &a is offsetted). Some field + offset remained COMPONENT_REF + offset.
next prev parent reply other threads:[~2011-09-26 9:12 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-09-20 8:16 [Bug middle-end/50460] New: " hjl.tools at gmail dot com 2011-09-20 10:49 ` [Bug middle-end/50460] " jakub at gcc dot gnu.org 2011-09-20 13:47 ` hjl.tools at gmail dot com 2011-09-22 22:06 ` rguenth at gcc dot gnu.org 2011-09-23 8:34 ` jakub at gcc dot gnu.org 2011-09-25 11:24 ` rguenth at gcc dot gnu.org 2011-09-26 9:14 ` jakub at gcc dot gnu.org [this message] 2011-09-28 12:29 ` rguenth at gcc dot gnu.org 2011-09-28 13:52 ` rguenth at gcc dot gnu.org 2011-09-28 14:01 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-50460-4-g0Q8uGTAwC@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).