summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/intent_out_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/intent_out_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/intent_out_1.f9019
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/intent_out_1.f90 b/gcc/testsuite/gfortran.dg/intent_out_1.f90
new file mode 100644
index 000000000..98338bf47
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intent_out_1.f90
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! Tests the fix for PRs 18578, 18579 and their repeats 20857 and 20885.
+! Contributed by Paul Thomas <pault@gcc@gnu.org>
+ real, parameter :: a =42.0
+ real :: b
+ call foo(b + 2.0) ! { dg-error "variable definition context" }
+ call foo(a) ! { dg-error "variable definition context" }
+ call bar(b + 2.0) ! { dg-error "variable definition context" }
+ call bar(a) ! { dg-error "variable definition context" }
+contains
+ subroutine foo(a)
+ real, intent(out) :: a
+ a = 0.0
+ end subroutine foo
+ subroutine bar(a)
+ real, intent(INout) :: a
+ a = 0.0
+ end subroutine bar
+end