gcc/
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr56799.c
blobd9ee26bc27fc2e78a6faac0d3e4635e61985617a
2 #include <stdio.h>
3 typedef struct { int x; int y;} S;
4 extern int foo(S*);
5 int hi = 0, lo = 0;
7 int main()
9 S a;
10 int r;
11 a.x = (int) 0x00010000;
12 a.y = 1;
13 r = foo (&a);
14 if (r == 2 && lo==0 && hi==1)
16 exit (0);
18 abort ();
21 typedef unsigned short u16;
23 __attribute__ ((noinline)) int foo (S* ptr)
25 int a = ptr->x;
26 int c = 0;
27 u16 b = (u16) a;
28 if (b != 0)
30 lo = 1;
31 c += ptr->y;
33 b = a >> 16;
34 if (b != 0)
36 hi = 1;
37 c+= ptr->y;
39 c += ptr->y;
40 return c;