public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tsv at solvo dot ru" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/24178] GCC 4.0/4.1 generates code that produces unaligned access exceptions Date: Tue, 04 Oct 2005 05:59:00 -0000 [thread overview] Message-ID: <20051004055903.6298.qmail@sourceware.org> (raw) In-Reply-To: <bug-24178-3055@http.gcc.gnu.org/bugzilla/> ------- Comment #3 from tsv at solvo dot ru 2005-10-04 05:59 ------- (In reply to comment #2) > (In reply to comment #0) > > > The offset of "p5" member is 25 bytes, but compiler thinks that "p5" is aligned > > in "foo" function > > You are casting a pointer to a Foo* that doesn't have proper alignment for > a Foo. This is undefined behavior, so anything can happen, including an > unaligned access at some later point. This is not a gcc bug. Correct me if I wrong, but loading long from passed pointer to char minus 4 is not correct too. I could agree if the compiler did substruct 25 from pointer and added 24 and that did load (it does it in not optimized version). In this case it would me me who passed incorrect pointer (in fact DEC C did that) and I agree with compiler that warns me about it. I can't test right now, but if I recall gcc 3.4 didn't have such problems. > > > It might be not very good coding practice, but it taken from Mozilla source. > > Please report it there instead. > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24178
next prev parent reply other threads:[~2005-10-04 5:59 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-10-03 18:36 [Bug c/24178] New: " tsv at solvo dot ru 2005-10-03 19:03 ` [Bug middle-end/24178] " pinskia at gcc dot gnu dot org 2005-10-03 20:48 ` falk at debian dot org 2005-10-04 5:59 ` tsv at solvo dot ru [this message] 2005-10-04 7:32 ` falk at debian dot org 2005-10-04 7:36 ` [Bug middle-end/24178] [4.0/4.1 regression] " falk at debian dot org 2005-10-14 13:30 ` tsv at solvo dot ru 2005-10-15 15:04 ` falk at debian dot org 2005-10-22 21:59 ` pinskia at gcc dot gnu dot org 2005-10-22 22:42 ` falk at debian dot org 2005-10-23 18:22 ` tsv at solvo dot ru 2005-10-23 18:29 ` [Bug target/24178] " pinskia at gcc dot gnu dot org 2005-10-30 23:32 ` pinskia at gcc dot gnu dot org 2005-11-02 7:13 ` rth at gcc dot gnu dot org 2005-11-02 7:43 ` rth at gcc dot gnu dot org 2005-11-02 18:20 ` rth at gcc dot gnu dot org 2005-11-02 22:26 ` tsv at solvo dot ru 2005-11-03 0:33 ` rth at gcc dot gnu dot org 2005-11-03 0:34 ` rth at gcc dot gnu dot org 2010-08-06 19:33 ` ubizjak at gmail dot com 2010-08-06 19:44 ` [Bug target/24178] [4.6 Regression] " ubizjak at gmail dot com 2010-08-06 19:46 ` [Bug target/24178] [4.0/4.1 regression] " rguenth at gcc dot gnu dot org 2010-08-06 20:00 ` ubizjak 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=20051004055903.6298.qmail@sourceware.org \ --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).