aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr35472.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr35472.c b/gcc/testsuite/gcc.c-torture/execute/pr35472.c
new file mode 100644
index 0000000..c8678e2
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr35472.c
@@ -0,0 +1,22 @@
+extern void abort (void);
+extern void *memset (void *s, int c, __SIZE_TYPE__ n);
+struct S { int i[16]; };
+struct S *p;
+void __attribute__((noinline))
+foo(struct S *a, struct S *b) { a->i[0] = -1; p = b; }
+void test (void)
+{
+ struct S a, b;
+ memset (&a.i[0], '\0', sizeof (a.i));
+ memset (&b.i[0], '\0', sizeof (b.i));
+ foo (&a, &b);
+ *p = a;
+ *p = b;
+ if (b.i[0] != -1)
+ abort ();
+}
+int main()
+{
+ test();
+ return 0;
+}