164 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! Detect incompatible argument shapes3module m4 integer :: ha = 15 contains6 subroutine s1(a)7 real, intent(in) :: a(2,3)8 end9 subroutine s2(a)10 real, intent(in) :: a(3,2)11 end12 subroutine s3(a)13 real, intent(in) :: a(3,*)14 end15 subroutine s4(a)16 real, intent(in) :: a(:,:)17 end18 subroutine s5(a)19 real, intent(in) :: a(..)20 end21 subroutine s6(a,n,m)22 integer, intent(in) :: n, m23 real, intent(in) :: a(n, m)24 end25 subroutine s6b(a,nn,mm)26 integer, intent(in) :: nn, mm27 real, intent(in) :: a(nn, mm)28 end29 subroutine s7(a,n,m)30 integer, intent(in) :: n, m31 real, intent(in) :: a(m, n)32 end33 subroutine s8(a,n,m)34 integer, intent(in) :: n, m35 real, intent(in) :: a(n+1,m+1)36 end37 subroutine s8b(a,n,m)38 integer, intent(in) :: n, m39 real, intent(in) :: a(n-1,m+2)40 end41 subroutine s9(a)42 real, intent(in) :: a(ha,ha)43 end44 subroutine s9b(a)45 real, intent(in) :: a(ha,ha)46 end47 subroutine s1c(s)48 procedure(s1) :: s49 end50 subroutine s2c(s)51 procedure(s2) :: s52 end53 subroutine s3c(s)54 procedure(s3) :: s55 end56 subroutine s4c(s)57 procedure(s4) :: s58 end59 subroutine s5c(s)60 procedure(s5) :: s61 end62 subroutine s6c(s)63 procedure(s6) :: s64 end65 subroutine s7c(s)66 procedure(s7) :: s67 end68 subroutine s8c(s)69 procedure(s8) :: s70 end71 subroutine s9c(s)72 procedure(s9) :: s73 end74end75 76program main77 use m78 procedure(s1), pointer :: ps179 procedure(s2), pointer :: ps280 procedure(s3), pointer :: ps381 procedure(s4), pointer :: ps482 procedure(s5), pointer :: ps583 procedure(s6), pointer :: ps684 procedure(s7), pointer :: ps785 procedure(s8), pointer :: ps886 procedure(s9), pointer :: ps987 call s1c(s1)88 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes89 call s1c(s2)90 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes91 call s1c(s3)92 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes93 call s1c(s4)94 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes95 call s1c(s5)96 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': distinct numbers of dummy arguments97 call s1c(s6)98 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes99 call s2c(s1)100 call s2c(s2)101 call s6c(s6)102 call s6c(s6b)103 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes104 call s6c(s7)105 !WARNING: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes106 call s6c(s8)107 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes108 call s7c(s6)109 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes110 call s7c(s8)111 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes112 call s8c(s6)113 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes114 call s8c(s7)115 call s8c(s8)116 !WARNING: Actual procedure argument has possible interface incompatibility with dummy argument 's=': possibly incompatible dummy argument #1: distinct dummy data object shapes [-Wproc-dummy-arg-shapes]117 call s8c(s8b)118 call s9c(s9)119 call s9c(s9b)120 ps1 => s1121 !ERROR: Procedure pointer 'ps1' associated with incompatible procedure designator 's2': incompatible dummy argument #1: incompatible dummy data object shapes122 ps1 => s2123 !ERROR: Procedure pointer 'ps1' associated with incompatible procedure designator 's3': incompatible dummy argument #1: incompatible dummy data object shapes124 ps1 => s3125 !ERROR: Procedure pointer 'ps1' associated with incompatible procedure designator 's4': incompatible dummy argument #1: incompatible dummy data object shapes126 ps1 => s4127 !ERROR: Procedure pointer 'ps1' associated with incompatible procedure designator 's5': incompatible dummy argument #1: incompatible dummy data object shapes128 ps1 => s5129 !ERROR: Procedure pointer 'ps1' associated with incompatible procedure designator 's6': distinct numbers of dummy arguments130 ps1 => s6131 !ERROR: Procedure pointer 'ps2' associated with incompatible procedure designator 's1': incompatible dummy argument #1: incompatible dummy data object shapes132 ps2 => s1133 ps2 => s2134 call s1c(ps1)135 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes136 call s1c(ps2)137 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes138 call s1c(ps3)139 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes140 call s1c(ps4)141 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes142 call s1c(ps5)143 !ERROR: Actual procedure argument has interface incompatible with dummy argument 's=': incompatible dummy argument #1: incompatible dummy data object shapes144 call s2c(ps1)145 call s2c(ps2)146 ps6 => s6147 ps6 => s6b148 !ERROR: Procedure pointer 'ps6' associated with incompatible procedure designator 's7': incompatible dummy argument #1: incompatible dummy data object shapes149 ps6 => s7150 !ERROR: Procedure pointer 'ps6' associated with incompatible procedure designator 's8': incompatible dummy argument #1: incompatible dummy data object shapes151 ps6 => s8152 !ERROR: Procedure pointer 'ps7' associated with incompatible procedure designator 's6': incompatible dummy argument #1: incompatible dummy data object shapes153 ps7 => s6154 !ERROR: Procedure pointer 'ps7' associated with incompatible procedure designator 's8': incompatible dummy argument #1: incompatible dummy data object shapes155 ps7 => s8156 ps8 => s8157 !WARNING: pointer 'ps8' and s8b may not be completely compatible procedures: possibly incompatible dummy argument #1: distinct dummy data object shapes [-Wproc-dummy-arg-shapes]158 ps8 => s8b159 !ERROR: Procedure pointer 'ps8' associated with incompatible procedure designator 's6': incompatible dummy argument #1: incompatible dummy data object shapes160 ps8 => s6161 !WARNING: Procedure pointer 'ps8' associated with incompatible procedure designator 's7': incompatible dummy argument #1: incompatible dummy data object shapes162 ps8 => s7163end164