aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2020-10-03 17:20:54 +0200
committerJan Hubicka <jh@suse.cz>2020-10-03 17:20:54 +0200
commita1f77106ec3f0005f0cfd3e1d083837afeb432f6 (patch)
tree1d5090b20692bd98d16c62694aa654b24aa28b1a
parentc34db4b6f8a5d80367c709309f9b00cb32630054 (diff)
downloadgcc-a1f77106ec3f0005f0cfd3e1d083837afeb432f6.zip
gcc-a1f77106ec3f0005f0cfd3e1d083837afeb432f6.tar.gz
gcc-a1f77106ec3f0005f0cfd3e1d083837afeb432f6.tar.bz2
Add gcc.dg/tree-ssa/modref-3.c testcase
* gcc.dg/tree-ssa/modref-3.c: New test.
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/modref-3.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-3.c b/gcc/testsuite/gcc.dg/tree-ssa/modref-3.c
new file mode 100644
index 0000000..668c6c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-3.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+struct a
+{
+ int b;
+ int c;
+};
+
+__attribute__ ((noclone, noinline))
+void
+test (struct a *a)
+{
+ a->b = 2;
+}
+int
+foo ()
+{
+ struct a a = {113,114};
+ test (&a);
+ return a.c;
+}
+int
+foo2 (struct a *a)
+{
+ a->b = 123;
+ a->c = 124;
+ test (a);
+ return a->c;
+}
+/* { dg-final { scan-tree-dump "return 114" "optimized"} } */
+/* { dg-final { scan-tree-dump "return 124" "optimized"} } */