| 1 |
#include <stdlib.h> |
| 2 |
#include <string.h> |
| 3 |
|
| 4 |
typedef struct |
| 5 |
{ |
| 6 |
char i1; |
| 7 |
short i2; |
| 8 |
long i4; |
| 9 |
long long i8; |
| 10 |
char str[2][10]; |
| 11 |
} a_t; |
| 12 |
|
| 13 |
const __as a_t A = |
| 14 |
{ |
| 15 |
12, 345, 678910, 1234567891011ll, |
| 16 |
{ |
| 17 |
"xxx..xxx", |
| 18 |
"yyy..yyy" |
| 19 |
} |
| 20 |
}; |
| 21 |
|
| 22 |
const __as volatile a_t V = |
| 23 |
{ |
| 24 |
12+1, 345+1, 678910+1, 1234567891011ll+1, |
| 25 |
{ |
| 26 |
"XXX..XXX", |
| 27 |
"YYY..YYY" |
| 28 |
} |
| 29 |
}; |
| 30 |
|
| 31 |
a_t A2; |
| 32 |
volatile a_t V2; |
| 33 |
|
| 34 |
#ifdef __AVR_HAVE_ELPM__ |
| 35 |
void eat_flash (void) |
| 36 |
{ |
| 37 |
__asm (".space 0x10000"); |
| 38 |
} |
| 39 |
__attribute__((__used__)) |
| 40 |
void (*pfun) (void); |
| 41 |
#endif |
| 42 |
|
| 43 |
int main (void) |
| 44 |
{ |
| 45 |
#ifdef __AVR_HAVE_ELPM__ |
| 46 |
pfun = eat_flash; |
| 47 |
#endif |
| 48 |
|
| 49 |
if (A.i1 != 12 |
| 50 |
|| A.i1 != V.i1 -1) |
| 51 |
abort(); |
| 52 |
|
| 53 |
if (A.i2 != 345 |
| 54 |
|| A.i2 != V.i2 -1) |
| 55 |
abort(); |
| 56 |
|
| 57 |
if (A.i4 != 678910 |
| 58 |
|| A.i4 != V.i4 -1) |
| 59 |
abort(); |
| 60 |
|
| 61 |
if (A.i8 != 1234567891011ll |
| 62 |
|| A.i8 != V.i8 -1) |
| 63 |
abort(); |
| 64 |
|
| 65 |
A2 = A; |
| 66 |
V2 = V; |
| 67 |
|
| 68 |
if (A2.i1 != 12 |
| 69 |
|| A2.i1 != V2.i1 -1) |
| 70 |
abort(); |
| 71 |
|
| 72 |
if (A2.i2 != 345 |
| 73 |
|| A2.i2 != V2.i2 -1) |
| 74 |
abort(); |
| 75 |
|
| 76 |
if (A2.i4 != 678910 |
| 77 |
|| A2.i4 != V2.i4 -1) |
| 78 |
abort(); |
| 79 |
|
| 80 |
if (A2.i8 != 1234567891011ll |
| 81 |
|| A2.i8 != V2.i8 -1) |
| 82 |
abort(); |
| 83 |
|
| 84 |
if (strcmp (A2.str[0], "xxx..xxx")) |
| 85 |
abort(); |
| 86 |
if (strcmp (A2.str[1], "yyy..yyy")) |
| 87 |
abort(); |
| 88 |
|
| 89 |
if (strcmp ((const char*) V2.str[0], "XXX..XXX")) |
| 90 |
abort(); |
| 91 |
if (strcmp ((const char*) V2.str[1], "YYY..YYY")) |
| 92 |
abort(); |
| 93 |
|
| 94 |
exit (0); |
| 95 |
return 0; |
| 96 |
} |