| 1 |
/* PR libstdc++/88101 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
|
| 4 |
int i1, i2; |
| 5 |
long double l1, l2; |
| 6 |
struct S { char a; short b; char c; int d; char e; long long f; char g; long double h; } s1, s2; |
| 7 |
struct T { int a; struct S b[3]; int c; } t1, t2; |
| 8 |
struct U { int a : 3; int : 2; int b : 15; int : 14; int c : 1; int : 0; int : 3; int d : 2; int : 3; int e : 13; int : 3; signed char f; } u1, u2; |
| 9 |
|
| 10 |
__attribute__((noipa)) void |
| 11 |
foo (int *i, long double *l, struct S *s, struct T *t, struct U *u) |
| 12 |
{ |
| 13 |
*i = 123; |
| 14 |
*l = -123.456L; |
| 15 |
s->a = 1; s->b = 2; s->c = 3; s->d = 4; s->e = 5; s->f = 6; s->g = 7; s->h = 18.52L; |
| 16 |
t->a = 8; t->c = 9; |
| 17 |
t->b[0].a = 11; t->b[0].b = 12; t->b[0].c = 13; t->b[0].d = 14; |
| 18 |
t->b[0].e = 15; t->b[0].f = 16; t->b[0].g = 17; t->b[0].h = 18.26L; |
| 19 |
t->b[1].a = 21; t->b[1].b = 22; t->b[1].c = 23; t->b[1].d = 24; |
| 20 |
t->b[1].e = 25; t->b[1].f = 26; t->b[1].g = 27; t->b[1].h = 28.26L; |
| 21 |
t->b[2].a = 31; t->b[2].b = 32; t->b[2].c = 33; t->b[2].d = 34; |
| 22 |
t->b[2].e = 35; t->b[2].f = 36; t->b[2].g = 37; t->b[2].h = 38.26L; |
| 23 |
u->a = -1; u->b = -1; u->c = -1; u->d = -1; u->e = -1; u->f = -1; |
| 24 |
} |
| 25 |
|
| 26 |
int |
| 27 |
main () |
| 28 |
{ |
| 29 |
__builtin_memset (&i2, -1, sizeof (i2)); |
| 30 |
__builtin_memset (&l2, -1, sizeof (i2)); |
| 31 |
__builtin_memset (&s2, -1, sizeof (s2)); |
| 32 |
__builtin_memset (&t2, -1, sizeof (t2)); |
| 33 |
__builtin_memset (&u2, -1, sizeof (u2)); |
| 34 |
foo (&i1, &l1, &s1, &t1, &u1); |
| 35 |
foo (&i2, &l2, &s2, &t2, &u2); |
| 36 |
__builtin_clear_padding (&i2); |
| 37 |
__builtin_clear_padding (&l2); |
| 38 |
__builtin_clear_padding (&s2); |
| 39 |
__builtin_clear_padding (&t2); |
| 40 |
__builtin_clear_padding (&u2); |
| 41 |
if (__builtin_memcmp (&i1, &i2, sizeof (i1)) |
| 42 |
|| __builtin_memcmp (&l1, &l2, sizeof (l1)) |
| 43 |
|| __builtin_memcmp (&s1, &s2, sizeof (s1)) |
| 44 |
|| __builtin_memcmp (&t1, &t2, sizeof (t1)) |
| 45 |
|| __builtin_memcmp (&u1, &u2, sizeof (u1))) |
| 46 |
__builtin_abort (); |
| 47 |
return 0; |
| 48 |
} |