summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/allocatable_dummy_2.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/allocatable_dummy_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/allocatable_dummy_2.f9028
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/allocatable_dummy_2.f90 b/gcc/testsuite/gfortran.dg/allocatable_dummy_2.f90
new file mode 100644
index 000000000..1f0864ba3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocatable_dummy_2.f90
@@ -0,0 +1,28 @@
+! { dg-do compile }
+! Check a few constraints for ALLOCATABLE dummy arguments.
+program alloc_dummy
+
+ implicit none
+ integer :: a(5)
+
+ call init(a) ! { dg-error "must be ALLOCATABLE" }
+
+contains
+
+ subroutine init(x)
+ integer, allocatable, intent(out) :: x(:)
+ end subroutine init
+
+ subroutine init2(x)
+ integer, allocatable, intent(in) :: x(:)
+
+ allocate(x(3)) ! { dg-error "variable definition context" }
+ end subroutine init2
+
+ subroutine kill(x)
+ integer, allocatable, intent(in) :: x(:)
+
+ deallocate(x) ! { dg-error "variable definition context" }
+ end subroutine kill
+
+end program alloc_dummy