[Bug c/52979] New: likely wrong code bug w/packed bitfields
regehr at cs dot utah.edu
gcc-bugzilla@gcc.gnu.org
Fri Apr 13 16:35:00 GMT 2012
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)
More information about the Gcc-bugs
mailing list