67 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Test 8.5.10 & 8.5.18 constraints on dummy argument declarations3 4module m5 6 type :: hasCoarray7 real, allocatable :: a(:)[:]8 end type9 type, extends(hasCoarray) :: extendsHasCoarray10 end type11 type :: hasCoarray212 type(hasCoarray) :: x13 end type14 type, extends(hasCoarray2) :: extendsHasCoarray215 end type16 17 real, allocatable :: coarray(:)[:]18 19 contains20 21 subroutine s01a(x)22 real, allocatable, intent(out) :: x(:)23 end subroutine24 subroutine s01c(x)25 real, intent(out) :: x(:)26 end subroutine27 subroutine s01b ! C846 - can only be caught at a call via explicit interface28 !ERROR: ALLOCATABLE coarray 'coarray' may not be associated with INTENT(OUT) dummy argument 'x='29 !ERROR: ALLOCATABLE dummy argument 'x=' is not a coarray but actual argument has corank 130 call s01a(coarray)31 call s01c(coarray) ! ok, dummy is not allocatable32 end subroutine33 34 subroutine s02(x) ! C84635 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray36 type(hasCoarray), intent(out) :: x37 end subroutine38 39 subroutine s03(x) ! C84640 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray41 type(extendsHasCoarray), intent(out) :: x42 end subroutine43 44 subroutine s04(x) ! C84645 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray46 type(hasCoarray2), intent(out) :: x47 end subroutine48 49 subroutine s05(x) ! C84650 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray51 type(extendsHasCoarray2), intent(out) :: x52 end subroutine53 54end module55 56subroutine s06(x) ! C84757 use ISO_FORTRAN_ENV, only: lock_type58 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, EVENT_TYPE or LOCK_TYPE59 type(lock_type), intent(out) :: x[*]60end subroutine61 62subroutine s07(x) ! C84763 use ISO_FORTRAN_ENV, only: event_type64 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, EVENT_TYPE or LOCK_TYPE65 type(event_type), intent(out) :: x[*]66end subroutine67