public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "borntraeger at de dot ibm dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/45017] miscompile with bitfield and optimization
Date: Sun, 25 Jul 2010 16:54:00 -0000	[thread overview]
Message-ID: <20100725165406.13738.qmail@sourceware.org> (raw)
In-Reply-To: <bug-45017-18712@http.gcc.gnu.org/bugzilla/>



------- Comment #11 from borntraeger at de dot ibm dot com  2010-07-25 16:54 -------
Something like the following should do the trick.
Is endian.h available on all supported platforms?


*** gcc.c-torture/execute/pr45017.c.orig
--- gcc.c-torture/execute/pr45017.c
***************
*** 1,9 ****
--- 1,17 ----
+ #include <endian.h>
+ 
  int tester(char *bytes)
  {
    union {
        struct {
+ #  if __BYTE_ORDER == __BIG_ENDIAN
+         unsigned int r2:4;
+         unsigned int r1:4;
+ #  endif
+ #  if __BYTE_ORDER == __LITTLE_ENDIAN
          unsigned int r1:4;
          unsigned int r2:4;
+ #  endif
        } fmt;
        char value[1];
    } ovl;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45017


  parent reply	other threads:[~2010-07-25 16:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-21 11:23 [Bug middle-end/45017] New: " borntraeger at de dot ibm dot com
2010-07-21 16:21 ` [Bug middle-end/45017] " rguenth at gcc dot gnu dot org
2010-07-22 12:15 ` rguenth at gcc dot gnu dot org
2010-07-22 12:15 ` rguenth at gcc dot gnu dot org
2010-07-22 12:41 ` borntraeger at de dot ibm dot com
2010-07-22 12:42 ` rguenther at suse dot de
2010-07-22 12:59 ` schwab at linux-m68k dot org
2010-07-23  2:49 ` drow at gcc dot gnu dot org
2010-07-23 13:17 ` danglin at gcc dot gnu dot org
2010-07-25 15:44 ` ebotcazou at gcc dot gnu dot org
2010-07-25 16:46 ` mikpe at it dot uu dot se
2010-07-25 16:54 ` borntraeger at de dot ibm dot com [this message]
2010-07-25 17:13 ` dave at hiauly1 dot hia dot nrc dot ca
2010-07-25 17:15 ` mikpe at it dot uu dot se
2010-07-26 10:13 ` borntraeger at de dot ibm 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=20100725165406.13738.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: link
Be 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).