aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr120354.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr120354.c')
-rw-r--r--gcc/testsuite/gcc.dg/pr120354.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr120354.c b/gcc/testsuite/gcc.dg/pr120354.c
new file mode 100644
index 0000000..6749737
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr120354.c
@@ -0,0 +1,33 @@
+/* PR120354: Test for -Wflex-array-member-not-at-end on union with
+ flexible array members. */
+/* { dg-do compile } */
+/* { dg-options "-Wflex-array-member-not-at-end" } */
+
+struct P {};
+union L {};
+
+union X {
+ int x[];
+ struct P y;
+};
+
+struct T {
+ union X x; /* { dg-warning "structure containing a flexible array member is not at the end of another structure" } */
+ int plug;
+};
+
+struct Q {
+ int len;
+ int data[];
+};
+
+union Y {
+ struct Q q;
+ union L y;
+};
+
+struct S {
+ union Y y; /* { dg-warning "structure containing a flexible array member is not at the end of another structure" } */
+ int plug;
+};
+