summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr46620.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/pr46620.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr46620.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr46620.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr46620.c b/gcc/testsuite/gcc.dg/pr46620.c
new file mode 100644
index 000000000..8cc71ebbb
--- /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);
+}