| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
extern void abort (void); |
| 4 |
|
| 5 |
struct Ustr |
| 6 |
{ |
| 7 |
unsigned char data[1]; |
| 8 |
}; |
| 9 |
|
| 10 |
static unsigned int |
| 11 |
ustr_xi__embed_val_get(const unsigned char *data) |
| 12 |
{ |
| 13 |
return (unsigned int)data[0]; |
| 14 |
} |
| 15 |
|
| 16 |
int __attribute__((noinline)) zero(void) { return 0; } |
| 17 |
|
| 18 |
static unsigned int |
| 19 |
ustr_len(const struct Ustr *s1) |
| 20 |
{ |
| 21 |
return ustr_xi__embed_val_get(s1->data + 1 + zero()); |
| 22 |
} |
| 23 |
|
| 24 |
int |
| 25 |
main() |
| 26 |
{ |
| 27 |
if (ustr_len (((struct Ustr *) "\x01" "\x0002" "s2")) != 2) |
| 28 |
abort (); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |