diff options
author | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-03-09 14:08:09 +0100 |
---|---|---|
committer | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-04-28 23:35:48 +0200 |
commit | 83ecbc042ff3a1cd788abe84fd16fa0e507714b2 (patch) | |
tree | 905bb7a6f5ced321534f30704ed90a738b0888f8 | |
parent | f8ebfae25297def77ebdb2baaf65f6c9079b67f4 (diff) |
Adds test to determine if parameter types escape
-rw-r--r-- | gcc/testsuite/gcc.dg/ipa/ipa-ea-09-parameter-type-escapes-0.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-ea-09-parameter-type-escapes-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-ea-09-parameter-type-escapes-0.c new file mode 100644 index 00000000000..70c8c1f248d --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-ea-09-parameter-type-escapes-0.c @@ -0,0 +1,25 @@ +/* { dg-do link } */ +/* { dg-options "-flto -fipa-hello-world -fdump-ipa-hello-world" } */ + +#include <stddef.h> + +struct astruct_s { _Bool a; _Bool b; _Bool c;}; +struct astruct_s astruct; // This should not escape +struct bstruct_s { _Bool a; _Bool b; _Bool c;}; +struct bstruct_s bstruct; // This should not escape + +// This will make astruct_s escape +__attribute__((externally_visible)) void escaping(struct astruct_s cstruct) {} +void non_escaping(struct bstruct_s dstruct) {} + +int main() +{ + astruct.a = 0; + bstruct.b = 0; +} + + +/* { dg-final { scan-wpa-ipa-dump "collected,astruct_s" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "type astruct_s is escaping true" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "collected,bstruct_s" "hello-world" } } */ +/* { dg-final { scan-wpa-ipa-dump "type bstruct_s is escaping false" "hello-world" } } */ |