summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/allocatable_dummy_2.f90
blob: 1f0864ba37154366121b1acea6d9da123f22b0de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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