summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c')
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c
new file mode 100644
index 00000000000..bf867b6cd43
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-25-array-cast-0.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-options "-flto -fipa-type-escape-analysis -fdump-ipa-type-escape-analysis" } */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stddef.h>
+
+int
+main ()
+{
+ struct astruct_s
+ {
+ _Bool a;
+ _Bool b;
+ _Bool c;
+ _Bool d;
+ };
+ struct astruct_s a[2];
+ struct bstruct_s
+ {
+ _Bool a;
+ _Bool c;
+ _Bool d;
+ };
+
+ struct astruct_s *a_1 = &(a[1]);
+ struct astruct_s *a_0 = a_1 - 1;
+ struct bstruct_s *b_1 = (struct bstruct_s *) a_1;
+ struct bstruct_s *b_0 = b_1 - 1;
+ assert ((struct bstruct_s *) a_0 != b_0);
+}