[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / call33.f90
blob7fad50cbbe7fa0d3059be9397fba04e67e43f04d
1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror
2 module m
3 contains
4 subroutine s1(x)
5 character(3) :: x
6 end
7 subroutine s2(x)
8 character(3) :: x(1)
9 end
10 subroutine s3(x)
11 character(3) :: x(:)
12 end
13 subroutine s4(x)
14 character(3) :: x(..)
15 end
16 subroutine s5(x)
17 character(3), allocatable :: x
18 end
19 subroutine s6(x)
20 character(3), pointer :: x
21 end
22 end
24 program test
25 use m
26 character(2) short, shortarr(1)
27 character(2), allocatable :: shortalloc
28 character(2), pointer :: shortptr
29 character(4) long, longarr(1)
30 character(4), allocatable :: longalloc
31 character(4), pointer :: longptr
32 !WARNING: Actual argument variable length '2' is less than expected length '3'
33 call s1(short)
34 !WARNING: Actual argument variable length '2' is less than expected length '3'
35 call s2(shortarr)
36 !ERROR: Actual argument variable length '2' does not match the expected length '3'
37 call s3(shortarr)
38 !ERROR: Actual argument variable length '2' does not match the expected length '3'
39 call s4(shortarr)
40 !ERROR: Actual argument variable length '2' does not match the expected length '3'
41 call s5(shortalloc)
42 !ERROR: Actual argument variable length '2' does not match the expected length '3'
43 call s6(shortptr)
44 call s1(long) ! ok
45 call s2(longarr) ! ok
46 !ERROR: Actual argument variable length '4' does not match the expected length '3'
47 call s3(longarr)
48 !ERROR: Actual argument variable length '4' does not match the expected length '3'
49 call s4(longarr)
50 !ERROR: Actual argument variable length '4' does not match the expected length '3'
51 call s5(longalloc)
52 !ERROR: Actual argument variable length '4' does not match the expected length '3'
53 call s6(longptr)
54 end