public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "leis at in dot tum.de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/63233] Missing Warray-bounds warning for array within struct Date: Thu, 11 Sep 2014 22:26:00 -0000 [thread overview] Message-ID: <bug-63233-4-GzQJI8Qx4z@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-63233-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63233 --- Comment #5 from leis at in dot tum.de --- Thanks. I did notice that I get warning with optimization but not without, which is strange indeed. However, obviously my real problem is more complicated, and I'm trying to understand if I violate the standard. If I pick apart the offending line (foo.a[1] = 99;): int* p1 = foo.a; //1 int* p2 = p1 + 1; //2 *p2 = 99; //3 Which of these lines causes the undefined behavior? Why should pointer p2 be invalid? Fundamentally, what I'm really trying to do, is to have two arrays (of different types) in a fixed-sized struct. One array grows from the front, and one from the end. Dynamically I make sure that they do not overlap, but the sizes of the two arrays are not known statically. Is it really violating the standard?
next prev parent reply other threads:[~2014-09-11 22:26 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-09-11 21:15 [Bug c/63233] New: Valid out of bounds access leads to undefined behavior leis at in dot tum.de 2014-09-11 21:29 ` [Bug c/63233] " pinskia at gcc dot gnu.org 2014-09-11 22:02 ` [Bug c/63233] Missing Warray-bounds warning for array within struct manu at gcc dot gnu.org 2014-09-11 22:14 ` pinskia at gcc dot gnu.org 2014-09-11 22:26 ` leis at in dot tum.de [this message] 2014-09-13 9:36 ` mikpelinux at gmail dot com
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-63233-4-GzQJI8Qx4z@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).