summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-ea-06-global-type-escapes-0.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa/ipa-ea-06-global-type-escapes-0.c')
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-ea-06-global-type-escapes-0.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-ea-06-global-type-escapes-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-ea-06-global-type-escapes-0.c
new file mode 100644
index 00000000000..4debd92e061
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-ea-06-global-type-escapes-0.c
@@ -0,0 +1,21 @@
+/* { 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;};
+__attribute__((externally_visible)) struct astruct_s astruct; // This should escape
+struct bstruct_s { _Bool a; _Bool b; _Bool c;};
+struct bstruct_s bstruct; // This should not escape
+
+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" } } */