summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr41317.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr41317.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr41317.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41317.c b/gcc/testsuite/gcc.c-torture/execute/pr41317.c
new file mode 100644
index 000000000..742068b9a
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr41317.c
@@ -0,0 +1,28 @@
+extern void abort (void);
+
+struct A
+{
+ int i;
+};
+struct B
+{
+ struct A a;
+ int j;
+};
+
+static void
+foo (struct B *p)
+{
+ ((struct A *)p)->i = 1;
+}
+
+int main()
+{
+ struct A a;
+ a.i = 0;
+ foo ((struct B *)&a);
+ if (a.i != 1)
+ abort ();
+ return 0;
+}
+