59 lines · plain
1! RUN: not %flang -fsyntax-only -pedantic 2>&1 %s | FileCheck %s2module m3 contains4 subroutine subr1(f)5 character(5) f6 print *, f('abcde')7 end subroutine8 subroutine subr2(f)9 character(*) f10 print *, f('abcde')11 end subroutine12 character(5) function explicitLength(x)13 character(5), intent(in) :: x14 explicitLength = x15 end function16 character(6) function badExplicitLength(x)17 character(5), intent(in) :: x18 badExplicitLength = x19 end function20 real function notChar(x)21 character(*), intent(in) :: x22 notChar = 023 end function24end module25 26character(*) function assumedLength(x)27 character(*), intent(in) :: x28 assumedLength = x29end function30 31subroutine subr3(f)32 character(5) f33 print *, f('abcde')34end subroutine35 36program main37 use m38 external assumedlength39 character(5) :: assumedlength40 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 error52 !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 error56 !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 program59