| 1 |
/* { dg-require-effective-target int32plus } */ |
| 2 |
|
| 3 |
#include <stdio.h> |
| 4 |
|
| 5 |
void abort (void); |
| 6 |
void exit (int); |
| 7 |
|
| 8 |
typedef struct { int x; int y;} S; |
| 9 |
extern int foo(S*); |
| 10 |
int hi = 0, lo = 0; |
| 11 |
|
| 12 |
int main() |
| 13 |
{ |
| 14 |
S a; |
| 15 |
int r; |
| 16 |
a.x = (int) 0x00010000; |
| 17 |
a.y = 1; |
| 18 |
r = foo (&a); |
| 19 |
if (r == 2 && lo==0 && hi==1) |
| 20 |
{ |
| 21 |
exit (0); |
| 22 |
} |
| 23 |
abort (); |
| 24 |
} |
| 25 |
|
| 26 |
typedef unsigned short u16; |
| 27 |
|
| 28 |
__attribute__ ((noinline)) int foo (S* ptr) |
| 29 |
{ |
| 30 |
int a = ptr->x; |
| 31 |
int c = 0; |
| 32 |
u16 b = (u16) a; |
| 33 |
if (b != 0) |
| 34 |
{ |
| 35 |
lo = 1; |
| 36 |
c += ptr->y; |
| 37 |
} |
| 38 |
b = a >> 16; |
| 39 |
if (b != 0) |
| 40 |
{ |
| 41 |
hi = 1; |
| 42 |
c+= ptr->y; |
| 43 |
} |
| 44 |
c += ptr->y; |
| 45 |
return c; |
| 46 |
} |
| 47 |
|
| 48 |
|