[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / resolve73.f90
blob90656966d4b179b31088042a17751a91b1caad38
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! C721 A type-param-value of * shall be used only
4 ! * to declare a dummy argument,
5 ! * to declare a named constant,
6 ! * in the type-spec of an ALLOCATE statement wherein each allocate-object is
7 ! a dummy argument of type CHARACTER with an assumed character length,
8 ! * in the type-spec or derived-type-spec of a type guard statement (11.1.11),
9 ! or
10 ! * in an external function, to declare the character length parameter of the function result.
11 subroutine s(arg)
12 character(len=*), pointer :: arg
13 character*(*), parameter :: cvar1 = "abc"
14 character*4, cvar2
15 character(len=4_4) :: cvar3
16 !ERROR: An assumed (*) type parameter may be used only for a (non-statement function) dummy argument, associate name, named constant, or external function result
17 character(len=*) :: cvar4
19 type derived(param)
20 integer, len :: param
21 class(*), allocatable :: x
22 end type
23 type(derived(34)) :: a
24 interface
25 function fun()
26 character(len=4) :: fun
27 end function fun
28 end interface
30 select type (ax => a%x)
31 type is (integer)
32 print *, "hello"
33 type is (character(len=*))
34 print *, "hello"
35 class is (derived(param=*))
36 print *, "hello"
37 class default
38 print *, "hello"
39 end select
41 allocate (character(len=*) :: arg)
42 end subroutine s