summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/reassoc_3.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/reassoc_3.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/reassoc_3.f9020
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/reassoc_3.f90 b/gcc/testsuite/gfortran.dg/reassoc_3.f90
new file mode 100644
index 000000000..84a339722
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/reassoc_3.f90
@@ -0,0 +1,20 @@
+! { dg-do compile }
+! { dg-options "-O -ffast-math -fdump-tree-original -fdump-tree-optimized" }
+
+! Verify we associate properly during folding
+! Verify we propagate constants in the presence of PAREN_EXPR
+
+function test(a)
+ real b, c, d
+ c = a
+ d = 5
+ b = (c + 5 - c)
+ b = (c + d - c)
+ test = a + b - 5
+end
+
+! { dg-final { scan-tree-dump "b = 5" "original" } }
+! { dg-final { scan-tree-dump "c_. = .a" "optimized" } }
+! { dg-final { scan-tree-dump "return c_.;" "optimized" } }
+! { dg-final { cleanup-tree-dump "original" } }
+! { dg-final { cleanup-tree-dump "optimized" } }