1! RUN: not %flang -fsyntax-only -pedantic 2>&1 %s | FileCheck %s 2module m 3 contains 4 subroutine subr1(f) 5 character(5) f 6 print *, f('abcde') 7 end subroutine 8 subroutine subr2(f) 9 character(*) f 10 print *, f('abcde') 11 end subroutine 12 character(5) function explicitLength(x) 13 character(5), intent(in) :: x 14 explicitLength = x 15 end function 16 character(6) function badExplicitLength(x) 17 character(5), intent(in) :: x 18 badExplicitLength = x 19 end function 20 real function notChar(x) 21 character(*), intent(in) :: x 22 notChar = 0 23 end function 24end module 25 26character(*) function assumedLength(x) 27 character(*), intent(in) :: x 28 assumedLength = x 29end function 30 31subroutine subr3(f) 32 character(5) f 33 print *, f('abcde') 34end subroutine 35 36program main 37 use m 38 external assumedlength 39 character(5) :: assumedlength 40 call subr1(explicitLength) 41 !CHECK: error: Actual argument function associated with procedure dummy argument 'f=' is not compatible: function results have distinct types: CHARACTER(KIND=1,LEN=5_8) vs CHARACTER(KIND=1,LEN=6_8) 42 call subr1(badExplicitLength) 43 call subr1(assumedLength) 44 !CHECK: error: Actual argument function associated with procedure dummy argument 'f=' is not compatible: function results have distinct types: CHARACTER(KIND=1,LEN=5_8) vs REAL(4) 45 call subr1(notChar) 46 call subr2(explicitLength) 47 call subr2(assumedLength) 48 !CHECK: error: Actual argument function associated with procedure dummy argument 'f=' is not compatible: function results have distinct types: CHARACTER(KIND=1,LEN=*) vs REAL(4) 49 call subr2(notChar) 50 call subr3(explicitLength) 51 !CHECK: warning: If the procedure's interface were explicit, this reference would be in error 52 !CHECK: because: Actual argument function associated with procedure dummy argument 'f=' is not compatible: function results have distinct types: CHARACTER(KIND=1,LEN=5_8) vs CHARACTER(KIND=1,LEN=6_8) 53 call subr3(badExplicitLength) 54 call subr3(assumedLength) 55 !CHECK: warning: If the procedure's interface were explicit, this reference would be in error 56 !CHECK: because: Actual argument function associated with procedure dummy argument 'f=' is not compatible: function results have distinct types: CHARACTER(KIND=1,LEN=5_8) vs REAL(4) 57 call subr3(notChar) 58end program 59