118334Speter/* PR tree-optimization/46620 */
290075Sobrien/* SRA bitfield grouping used to lose track at padding bitfields in
390075Sobrien   the middle of a word.  */
418334Speter/* { dg-do run } */
590075Sobrien/* { dg-options "-O2" } */
618334Speter
790075Sobrien#include <stdlib.h>
890075Sobrien
990075Sobrienstruct PCT
1090075Sobrien{
1118334Speter  unsigned char	pi1	: 4;
1290075Sobrien  unsigned char	pi2	: 3;
1390075Sobrien  unsigned char	pif	: 5;
1490075Sobrien
1590075Sobrien  unsigned char	sl	: 2;
1618334Speter  unsigned char	uc	: 1;
1718334Speter  unsigned char	st	: 1;
1890075Sobrien
1990075Sobrien  unsigned char	p	: 1;
2090075Sobrien  unsigned char	cs	: 1;
2118334Speter  unsigned char	ss	: 1;
2218334Speter
2350397Sobrien  unsigned char	pc	: 3;
2450397Sobrien  unsigned char	dmv	: 4;
2518334Speter  unsigned char	cv	: 4;
2618334Speter};
2790075Sobrien
2818334Speterstruct rt
2950397Sobrien{
3050397Sobrien  struct rt*		d;
3190075Sobrien  void (*edo)(void * const);
3290075Sobrien  short			lId;
3390075Sobrien  char          dac;
3490075Sobrien};
3518334Speter
3690075Sobrienstruct pedr
3790075Sobrien{
3818334Speter  struct rt re;
3952284Sobrien  struct PCT pc;
4090075Sobrien  unsigned char mid;
4118334Speter} ;
4252284Sobrien
4352284Sobrienvoid __attribute__((__noinline__))
4452284Sobrienrei(struct rt* const me, unsigned short anId, void *ad )
4552284Sobrien{
4652284Sobrien  asm volatile ("");
4752284Sobrien}
4852284Sobrien
4952284Sobrienvoid __attribute__((__noinline__))
5018334Speterpedrdo(void * const p)
5152284Sobrien{
5252284Sobrien  asm volatile ("");
5390075Sobrien}
5490075Sobrien
5590075Sobrienvoid __attribute__((__noinline__))
5690075Sobrienpedri (struct pedr* const  me, struct PCT ppc, unsigned char pmid)
5790075Sobrien{
5890075Sobrien  rei(&(me->re), 0x7604, 0);
5990075Sobrien  me->pc = ppc;
6090075Sobrien  me->mid = pmid;
6152284Sobrien  (me)->re.edo = pedrdo;
6290075Sobrien}
6390075Sobrien
6490075Sobrienint main()
6590075Sobrien{
6652284Sobrien  struct PCT ps;
6790075Sobrien  struct pedr pm;
6852284Sobrien
6952284Sobrien  pm.pc.dmv = 0;
7052284Sobrien  ps.dmv = 1;
7152284Sobrien  pedri(&pm, ps, 32);
7252284Sobrien
7352284Sobrien  if (pm.pc.dmv != 1)
7452284Sobrien    abort ();
7552284Sobrien  exit (0);
7652284Sobrien}
7752284Sobrien