summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c')
-rw-r--r--gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c
new file mode 100644
index 00000000000..c86bce1f885
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/ipa-structreorg-23-array-cast-0.c
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-flto -flto-partition=none -fipa-dead-field-eliminate -fdump-ipa-structure-reorg -fipa-typelist-field=b -fipa-typelist-struct=astruct_s" } */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stddef.h>
+
+int
+main ()
+{
+ struct astruct_s
+ {
+ _Bool a;
+ _Bool b;
+ _Bool c;
+ };
+ struct astruct_s a[2];
+ struct bstruct_s
+ {
+ _Bool a;
+ _Bool c;
+ };
+ struct astruct_s *a_0 = &(a[0]);
+ struct astruct_s *a_1 = a_0 + 1;
+ struct bstruct_s *b_0 = (struct bstruct_s *) a_0;
+ struct bstruct_s *b_1 = b_0 + 1;
+ assert ((struct bstruct_s *) a_1 == b_1);
+}