| 1 |
/* PR middle-end/110027 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-additional-options "-fstack-protector-strong" { target fstack_protector } } */ |
| 4 |
/* { dg-set-target-env-var ASAN_OPTIONS "detect_stack_use_after_return=1" } */ |
| 5 |
|
| 6 |
struct __attribute__((aligned (128))) S { char s[128]; }; |
| 7 |
struct __attribute__((aligned (64))) T { char s[192]; }; |
| 8 |
struct __attribute__((aligned (32))) U { char s[256]; }; |
| 9 |
struct __attribute__((aligned (64))) V { char s[320]; }; |
| 10 |
struct __attribute__((aligned (128))) W { char s[512]; }; |
| 11 |
|
| 12 |
__attribute__((noipa)) void |
| 13 |
foo (void *p, void *q, void *r, void *s) |
| 14 |
{ |
| 15 |
if (((__UINTPTR_TYPE__) p & 31) != 0 |
| 16 |
|| ((__UINTPTR_TYPE__) q & 127) != 0 |
| 17 |
|| ((__UINTPTR_TYPE__) r & 63) != 0) |
| 18 |
__builtin_abort (); |
| 19 |
(void *) s; |
| 20 |
} |
| 21 |
|
| 22 |
__attribute__((noipa)) int |
| 23 |
bar (void) |
| 24 |
{ |
| 25 |
struct U u; |
| 26 |
struct S s; |
| 27 |
struct T t; |
| 28 |
char p[4]; |
| 29 |
foo (&u, &s, &t, &p); |
| 30 |
return 42; |
| 31 |
} |
| 32 |
|
| 33 |
__attribute__((noipa)) int |
| 34 |
baz (void) |
| 35 |
{ |
| 36 |
struct W w; |
| 37 |
struct U u; |
| 38 |
struct V v; |
| 39 |
char p[4]; |
| 40 |
foo (&u, &w, &v, &p); |
| 41 |
return 42; |
| 42 |
} |
| 43 |
|
| 44 |
int |
| 45 |
main () |
| 46 |
{ |
| 47 |
bar (); |
| 48 |
baz (); |
| 49 |
return 0; |
| 50 |
} |