public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "larsbj at gullik dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/65081] New: -fsanitize=object-size fails with simple pointer arithm Date: Mon, 16 Feb 2015 18:22:00 -0000 [thread overview] Message-ID: <bug-65081-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65081 Bug ID: 65081 Summary: -fsanitize=object-size fails with simple pointer arithm Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: larsbj at gullik dot net CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org With: gcc (GCC) 5.0.0 20150216 (experimental) as of 220738 and this test snippet: ----------- struct intro { int a; char pad_[1]; }; struct intro b; struct intro * alloc() { struct intro * i = &b; return i + 1; } int main(void) { struct intro * i = alloc() - 1; i->a = 1; } ----------- I get this report: test.c:17:10: runtime error: store to address 0x0000006010a0 with insufficient space for an object of type 'int' 0x0000006010a0: note: pointer points here 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ When compiled like this: gcc -O1 -fsanitize=object-size test.c -fno-inline removes the runtime error, as do removing the pad_ from the intro struct. This is possibly an duplicate of bug 63303, but the errors are quite different.
next reply other threads:[~2015-02-16 18:22 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-02-16 18:22 larsbj at gullik dot net [this message] 2015-02-16 18:28 ` [Bug sanitizer/65081] " redi at gcc dot gnu.org 2015-02-17 9:39 ` mpolacek at gcc dot gnu.org 2015-02-17 9:49 ` mpolacek at gcc dot gnu.org 2015-02-17 10:38 ` jakub at gcc dot gnu.org 2015-02-17 10:46 ` mpolacek at gcc dot gnu.org 2015-02-18 9:47 ` mpolacek at gcc dot gnu.org 2015-02-18 9:47 ` mpolacek 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-65081-4@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).