[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / call04.f90
blobeb4f78f8f541f0d3aa38781eb3ad28a683a775ac
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! Test 8.5.10 & 8.5.18 constraints on dummy argument declarations
5 module m
7 type :: hasCoarray
8 real, allocatable :: a(:)[:]
9 end type
10 type, extends(hasCoarray) :: extendsHasCoarray
11 end type
12 type :: hasCoarray2
13 type(hasCoarray) :: x
14 end type
15 type, extends(hasCoarray2) :: extendsHasCoarray2
16 end type
18 real, allocatable :: coarray(:)[:]
20 contains
22 subroutine s01a(x)
23 real, allocatable, intent(out) :: x(:)
24 end subroutine
25 subroutine s01b ! C846 - can only be caught at a call via explicit interface
26 !ERROR: ALLOCATABLE coarray 'coarray' may not be associated with INTENT(OUT) dummy argument 'x='
27 !ERROR: ALLOCATABLE dummy argument 'x=' has corank 0 but actual argument has corank 1
28 call s01a(coarray)
29 end subroutine
31 subroutine s02(x) ! C846
32 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray
33 type(hasCoarray), intent(out) :: x
34 end subroutine
36 subroutine s03(x) ! C846
37 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray
38 type(extendsHasCoarray), intent(out) :: x
39 end subroutine
41 subroutine s04(x) ! C846
42 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray
43 type(hasCoarray2), intent(out) :: x
44 end subroutine
46 subroutine s05(x) ! C846
47 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, an ALLOCATABLE coarray
48 type(extendsHasCoarray2), intent(out) :: x
49 end subroutine
51 end module
53 subroutine s06(x) ! C847
54 use ISO_FORTRAN_ENV, only: lock_type
55 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, EVENT_TYPE or LOCK_TYPE
56 type(lock_type), intent(out) :: x
57 end subroutine
59 subroutine s07(x) ! C847
60 use ISO_FORTRAN_ENV, only: event_type
61 !ERROR: An INTENT(OUT) dummy argument may not be, or contain, EVENT_TYPE or LOCK_TYPE
62 type(event_type), intent(out) :: x
63 end subroutine