summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/intent_optimize_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/intent_optimize_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/intent_optimize_1.f9024
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/intent_optimize_1.f90 b/gcc/testsuite/gfortran.dg/intent_optimize_1.f90
new file mode 100644
index 000000000..dbe0128d7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intent_optimize_1.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+! { dg-options "-O2 -fdump-tree-optimized" }
+!
+! Check whether the "does_not_exist" subroutine has been
+! optimized away, i.e. check that "foo"'s intent(IN) gets
+! honoured.
+!
+! PR fortran/43665
+!
+interface
+ subroutine foo(x)
+ integer, intent(in) :: x
+ end subroutine foo
+end interface
+
+integer :: y
+
+y = 5
+call foo(y)
+if (y /= 5) call does_not_exist ()
+end
+
+! { dg-final { scan-tree-dump-times "does_not_exist" 0 "optimized" } }
+! { dg-final { cleanup-tree-dump "optimized" } }