diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2011-02-19 21:02:35 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2011-02-19 21:02:35 +0000 |
commit | e67401c78f7966e75ad348b3b8953741c89342e2 (patch) | |
tree | e5698bb165efa254c80775514567d4e6af690a56 /gcc | |
parent | b2cddfc892d0a59afb01941407873271415e1d9d (diff) | |
download | gcc-e67401c78f7966e75ad348b3b8953741c89342e2.zip gcc-e67401c78f7966e75ad348b3b8953741c89342e2.tar.gz gcc-e67401c78f7966e75ad348b3b8953741c89342e2.tar.bz2 |
re PR tree-optimization/46620 (32-bit structures containing bitfields are not copied correctly on -O2 , x86 backend)
PR tree-optimization/46620
* gcc.dg/pr46620.c: New.
From-SVN: r170325
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr46620.c | 76 |
2 files changed, 81 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0b9dc0c..db9b51d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-02-19 Alexandre Oliva <aoliva@redhat.com> + + PR tree-optimization/46620 + * gcc.dg/pr46620.c: New. + 2011-02-19 Jakub Jelinek <jakub@redhat.com> PR c/47809 diff --git a/gcc/testsuite/gcc.dg/pr46620.c b/gcc/testsuite/gcc.dg/pr46620.c new file mode 100644 index 0000000..8cc71eb --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr46620.c @@ -0,0 +1,76 @@ +/* PR tree-optimization/46620 */ +/* SRA bitfield grouping used to lose track at padding bitfields in + the middle of a word. */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +#include <stdlib.h> + +struct PCT +{ + unsigned char pi1 : 4; + unsigned char pi2 : 3; + unsigned char pif : 5; + + unsigned char sl : 2; + unsigned char uc : 1; + unsigned char st : 1; + + unsigned char p : 1; + unsigned char cs : 1; + unsigned char ss : 1; + + unsigned char pc : 3; + unsigned char dmv : 4; + unsigned char cv : 4; +}; + +struct rt +{ + struct rt* d; + void (*edo)(void * const); + short lId; + char dac; +}; + +struct pedr +{ + struct rt re; + struct PCT pc; + unsigned char mid; +} ; + +void __attribute__((__noinline__)) +rei(struct rt* const me, unsigned short anId, void *ad ) +{ + asm volatile (""); +} + +void __attribute__((__noinline__)) +pedrdo(void * const p) +{ + asm volatile (""); +} + +void __attribute__((__noinline__)) +pedri (struct pedr* const me, struct PCT ppc, unsigned char pmid) +{ + rei(&(me->re), 0x7604, 0); + me->pc = ppc; + me->mid = pmid; + (me)->re.edo = pedrdo; +} + +int main() +{ + struct PCT ps; + struct pedr pm; + + pm.pc.dmv = 0; + ps.dmv = 1; + pedri(&pm, ps, 32); + + if (pm.pc.dmv != 1) + abort (); + exit (0); +} |