| 1 |
/* PR libstdc++/88101 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
|
| 4 |
struct S {} s1, s2; |
| 5 |
struct T : public S { char a; short b; char c; } t1, t2; |
| 6 |
struct U : public T { char d; long long e; char f; } u1, u2; |
| 7 |
|
| 8 |
__attribute__((noipa)) void |
| 9 |
foo (T *t, U *u) |
| 10 |
{ |
| 11 |
int i; |
| 12 |
t->a = -1; t->b = -1; t->c = -1; |
| 13 |
u->a = -1; u->b = -1; u->c = -1; u->d = -1; u->e = -1; u->f = -1; |
| 14 |
} |
| 15 |
|
| 16 |
int |
| 17 |
main () |
| 18 |
{ |
| 19 |
__builtin_memset (&s2, -1, sizeof (s2)); |
| 20 |
__builtin_memset (&t2, -1, sizeof (t2)); |
| 21 |
__builtin_memset (&u2, -1, sizeof (u2)); |
| 22 |
foo (&t1, &u1); |
| 23 |
foo (&t2, &u2); |
| 24 |
__builtin_clear_padding (&s2); |
| 25 |
__builtin_clear_padding (&t2); |
| 26 |
__builtin_clear_padding (&u2); |
| 27 |
if (__builtin_memcmp (&s1, &s2, sizeof (s1)) |
| 28 |
|| __builtin_memcmp (&t1, &t2, sizeof (t1)) |
| 29 |
|| __builtin_memcmp (&u1, &u2, sizeof (u1))) |
| 30 |
__builtin_abort (); |
| 31 |
return 0; |
| 32 |
} |