summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-08-modify-double-struct-0.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa/ipa-structreorg-08-modify-double-struct-0.c')
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-08-modify-double-struct-0.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-08-modify-double-struct-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-08-modify-double-struct-0.c
new file mode 100644
index 00000000000..17217924eba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-08-modify-double-struct-0.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis -Wno-dfa -fipa-dlo-tests" } */
+
+#include <assert.h>
+#include <stdio.h>
+int
+main ()
+{
+ struct inner_s
+ {
+ _Bool a;
+ _Bool b;
+ _Bool c;
+ _Bool d;
+ };
+ struct astruct_s
+ {
+ struct inner_s a;
+ struct inner_s b;
+ struct inner_s c;
+ struct inner_s d;
+ };
+ struct astruct_s astruct;
+ // printf("%d %d %d\n", &astruct.a, &astruct.c, &astruct.d);
+ struct inner_s *a_ptr = &(astruct.a);
+ struct inner_s *c_ptr = &(astruct.c);
+ struct inner_s *d_ptr = &(astruct.d);
+ printf ("%d %d %d %d\n", a_ptr->a, a_ptr->b, a_ptr->c, a_ptr->d);
+ struct inner_s *c_ptr_2 = a_ptr + 1;
+ struct inner_s *a_ptr_2 = d_ptr - 2;
+ assert (c_ptr_2 == c_ptr);
+ assert (a_ptr == a_ptr_2);
+}