2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / compat / sdata-1_x.c
blobfc7b8cef333b50df859dc40109e6e1a01a77cca9
1 #include "sdata-section.h"
3 struct s { int x; int y[4]; };
4 extern struct s small_struct SDATA_SECTION;
6 /* Test "load address" operations. */
7 int *xaddr (void) { return &small_struct.x; }
8 int *yaddr (int i) { return &small_struct.y[i]; }
10 void sdata_1_x (void)
12 int i;
14 /* Test direct accesses. */
15 small_struct.x = 5;
16 for (i = 0; i < 4; i++)
17 small_struct.y[i] = i + 42;
19 if (*xaddr () != 5)
20 abort ();
22 for (i = 0; i < 4; i++)
23 if (*yaddr (i) != i + 42)
24 abort ();