summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr38405.c
blob: 3f93445cd65668cf1525269ede1fed3c492f6dd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* { dg-do run } */

extern void abort ();
extern int printf (char *__format, ...);

struct vpiBinaryConst {
 int signed_flag :1;
 int sized_flag :1;
};

int binary_get(int code, struct vpiBinaryConst *rfp)
{
 switch (code) {
  case 1:
   return rfp->signed_flag ? 1 : 0;
  default:
   printf("error: %d not supported\n", code);
   return code;
 }
}

int main(void)
{
 struct vpiBinaryConst x={1,0};
 int y=binary_get(1, &x);
 if (y!=1)
   abort ();
 return 0;
}