From a1f77106ec3f0005f0cfd3e1d083837afeb432f6 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 3 Oct 2020 17:20:54 +0200 Subject: [PATCH] Add gcc.dg/tree-ssa/modref-3.c testcase * gcc.dg/tree-ssa/modref-3.c: New test. --- gcc/testsuite/gcc.dg/tree-ssa/modref-3.c | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/modref-3.c 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 00000000000..668c6c28831 --- /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"} } */ -- 2.30.2