public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "regehr at cs dot utah.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/52979] New: likely wrong code bug w/packed bitfields
Date: Fri, 13 Apr 2012 16:35:00 -0000	[thread overview]
Message-ID: <bug-52979-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 52979
           Summary: likely wrong code bug w/packed bitfields
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: regehr@cs.utah.edu
                CC: chenyang@cs.utah.edu


[regehr@dyson r30]$ current-gcc -O2 small.c ; ./a.out 
0
[regehr@dyson r30]$ current-gcc -O3 small.c ; ./a.out 
1
[regehr@dyson r30]$ cat small.c
int printf (const char *, ...);
int c, d, e;

void fn1 ()
{
}

#pragma pack(1)
struct S1
{
    int f0:31;
    int f1:6;
} 
a = { 1 };

static struct S1 b = { 1 };

void fn2 ()
{
    for (;;)
    {
        a.f1 = 1;
        struct S1 f = { };
        b = f;
        e = 0;
        if (d)
            c = a.f0;
        break;
    }
}

void fn3 ()
{
    fn2 ();
    a = b;
}

int main (void)
{
    fn3 ();
    printf ("%d\n", a.f0);
    return 0;
}
[regehr@dyson r30]$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r186403-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r186403-install
--program-prefix=r186403- --enable-languages=c,c++
Thread model: posix
gcc version 4.8.0 20120413 (experimental) (GCC)


             reply	other threads:[~2012-04-13 16:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 16:35 regehr at cs dot utah.edu [this message]
2012-04-16  9:46 ` [Bug tree-optimization/52979] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
2012-04-23 17:39 ` jakub at gcc dot gnu.org
2012-04-23 17:48 ` regehr at cs dot utah.edu
2012-04-24 10:48 ` jakub at gcc dot gnu.org
2012-04-24 11:42 ` jakub at gcc dot gnu.org
2012-04-24 12:00 ` rguenth at gcc dot gnu.org
2012-04-24 12:29 ` rguenth at gcc dot gnu.org
2012-04-24 15:34 ` jakub at gcc dot gnu.org
2012-04-25 14:27 ` jakub at gcc dot gnu.org
2012-04-25 18:37 ` [Bug tree-optimization/52979] [4.7 " jakub at gcc dot gnu.org
2012-04-26 14:16 ` rguenth at gcc dot gnu.org
2012-06-04 10:20 ` rguenth at gcc dot gnu.org
2012-06-04 10:24 ` rguenth 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-52979-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: 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).