| 1 |
#include "sdata-section.h" |
| 2 |
|
| 3 |
struct s { int x; int y[4]; }; |
| 4 |
extern struct s small_struct SDATA_SECTION; |
| 5 |
|
| 6 |
/* Test "load address" operations. */ |
| 7 |
int *xaddr (void) { return &small_struct.x; } |
| 8 |
int *yaddr (int i) { return &small_struct.y[i]; } |
| 9 |
|
| 10 |
void sdata_1_x (void) |
| 11 |
{ |
| 12 |
int i; |
| 13 |
|
| 14 |
/* Test direct accesses. */ |
| 15 |
small_struct.x = 5; |
| 16 |
for (i = 0; i < 4; i++) |
| 17 |
small_struct.y[i] = i + 42; |
| 18 |
|
| 19 |
if (*xaddr () != 5) |
| 20 |
abort (); |
| 21 |
|
| 22 |
for (i = 0; i < 4; i++) |
| 23 |
if (*yaddr (i) != i + 42) |
| 24 |
abort (); |
| 25 |
} |