public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "arthur.j.odwyer at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/36043] gcc reads 8 bytes for a struct of size 6 which leads to sigsegv Date: Tue, 25 Feb 2014 19:45:00 -0000 [thread overview] Message-ID: <bug-36043-4-YZqpJ9MnQT@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-36043-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36043 Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arthur.j.odwyer at gmail dot com --- Comment #22 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> --- Here's another segfaulting test case, for x86-64. This fails with GCC 4.6.2 and GCC 4.8.1. This GCC bug is really hard to work around, since it can strike anywhere without warning. Is it possible that one of the patches above (e.g., Richard Biener's comment #9) could be adopted into 4.8.x or 4.9.x? #include <cstdio> #include <stdint.h> #include <sys/mman.h> struct int24_t { uint8_t m_Internal[3]; }; void foo(int24_t a) { puts("2"); } int main() { const int OS_PAGE_SIZE = 0x1000; const int COUNT = (OS_PAGE_SIZE) / sizeof(int24_t); printf("sizeof int24_t = %d\n", (int)sizeof(int24_t)); void* arena1 = mmap(0, OS_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); int24_t* ptr = (int24_t*)mmap(0, OS_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); munmap(arena1, OS_PAGE_SIZE); puts("1"); foo(ptr[COUNT-1]); puts("3"); }
next prev parent reply other threads:[~2014-02-25 19:45 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-36043-4@http.gcc.gnu.org/bugzilla/> 2011-03-28 12:03 ` rguenth at gcc dot gnu.org 2011-03-28 12:17 ` rguenth at gcc dot gnu.org 2012-02-02 15:08 ` bergner at gcc dot gnu.org 2012-02-02 15:47 ` bergner at gcc dot gnu.org 2014-02-22 21:09 ` david at fries dot net 2014-02-23 0:03 ` support@zzz-deskmobile.desk-mail.com 2014-02-25 19:45 ` arthur.j.odwyer at gmail dot com [this message] 2015-03-14 3:57 ` amodra at gmail dot com 2015-04-15 7:29 ` amodra at gcc dot gnu.org 2015-04-30 11:12 ` amodra at gcc dot gnu.org 2015-04-30 11:15 ` amodra at gmail dot com 2015-04-30 11:18 ` john.dallman at siemens 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-36043-4-YZqpJ9MnQT@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).