summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr59374-3.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr59374-3.c')
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr59374-3.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr59374-3.c b/gcc/testsuite/gcc.dg/torture/pr59374-3.c
new file mode 100644
index 00000000000..ab0014d8f13
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr59374-3.c
@@ -0,0 +1,21 @@
+extern void abort (void);
+
+static struct X { void *a; void *b; } a, b;
+
+void __attribute__((noinline)) foo (void)
+{
+ void *tem = a.b;
+ a.b = (void *)0;
+ b.b = tem;
+ b.a = a.a;
+ a.a = tem;
+}
+
+int main()
+{
+ a.b = &a;
+ foo ();
+ if (b.b != &a)
+ abort ();
+ return 0;
+}