GCC 4.3.2-1 debian gnueabi and trunk at rev 142984 generate wrong code at -O2
and above for pr37868.c
gue...@gcc50:~$ /home/guerby/build-142984/gcc/xgcc
-B/home/guerby/build-142984/gcc/
/home/guerby/trunk/gcc/testsuite/gcc.dg/torture/pr37868.c -O2 -lm -o
./pr37868.exegue...@gcc50:~$ ./pr37868.exe
Aborted
gue...@gcc50:~$ cat /home/guerby/trunk/gcc/testsuite/gcc.dg/torture/pr37868.c
/* { dg-do run } */
/* { dg-options "-fno-strict-aliasing" } */
/* { dg-skip-if "unaligned access" { sparc*-*-* } "*" "" } */
extern void abort (void);
struct X {
unsigned char pad : 4;
unsigned int a : 32;
unsigned int b : 24;
unsigned int c : 6;
} __attribute__((packed));
int main (void)
{
struct X x;
unsigned int bad_bits;
x.pad = -1;
x.a = -1;
x.b = -1;
x.c = -1;
bad_bits = ((unsigned int)-1) ^ *(1+(unsigned int *) &x);
if (bad_bits != 0)
abort ();
return 0;
}
--
Summary: gcc.dg/torture/pr37868.c wrong code at -O2 and above for
4.3 and trunk / bit packing
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: laurent at guerby dot net
GCC build triplet: arm-linux-gnueabi
GCC host triplet: arm-linux-gnueabi
GCC target triplet: arm-linux-gnueabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38696