PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / pr46620.c
blob8cc71ebbb180d285e40a92b4b5759002606c1f2a
1 /* PR tree-optimization/46620 */
2 /* SRA bitfield grouping used to lose track at padding bitfields in
3 the middle of a word. */
4 /* { dg-do run } */
5 /* { dg-options "-O2" } */
7 #include <stdlib.h>
9 struct PCT
11 unsigned char pi1 : 4;
12 unsigned char pi2 : 3;
13 unsigned char pif : 5;
15 unsigned char sl : 2;
16 unsigned char uc : 1;
17 unsigned char st : 1;
19 unsigned char p : 1;
20 unsigned char cs : 1;
21 unsigned char ss : 1;
23 unsigned char pc : 3;
24 unsigned char dmv : 4;
25 unsigned char cv : 4;
28 struct rt
30 struct rt* d;
31 void (*edo)(void * const);
32 short lId;
33 char dac;
36 struct pedr
38 struct rt re;
39 struct PCT pc;
40 unsigned char mid;
41 } ;
43 void __attribute__((__noinline__))
44 rei(struct rt* const me, unsigned short anId, void *ad )
46 asm volatile ("");
49 void __attribute__((__noinline__))
50 pedrdo(void * const p)
52 asm volatile ("");
55 void __attribute__((__noinline__))
56 pedri (struct pedr* const me, struct PCT ppc, unsigned char pmid)
58 rei(&(me->re), 0x7604, 0);
59 me->pc = ppc;
60 me->mid = pmid;
61 (me)->re.edo = pedrdo;
64 int main()
66 struct PCT ps;
67 struct pedr pm;
69 pm.pc.dmv = 0;
70 ps.dmv = 1;
71 pedri(&pm, ps, 32);
73 if (pm.pc.dmv != 1)
74 abort ();
75 exit (0);