public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52979] New: likely wrong code bug w/packed bitfields
@ 2012-04-13 16:35 regehr at cs dot utah.edu
  2012-04-16  9:46 ` [Bug tree-optimization/52979] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: regehr at cs dot utah.edu @ 2012-04-13 16:35 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-06-04 10:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 16:35 [Bug c/52979] New: likely wrong code bug w/packed bitfields regehr at cs dot utah.edu
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

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).