summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-03-09 14:08:09 +0100
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-06-03 16:05:18 +0200
commit3ee7b710e434faee2aeb07286756bf4ac3c5a671 (patch)
treeca2f5cab30b456633ee16437066c4d38fee82ed7 /gcc/testsuite
parent131d81e97cbc5b666c33c884507e7fe8a0ee0d94 (diff)
Adds test to determine if parameter types escape
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-ea-09-parameter-type-escapes-0.c25
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" } } */