58 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -Werror2! Catch discrepancies between a local interface and a global definition3 4subroutine global1(x)5 integer, intent(in) :: x6end subroutine7 8subroutine global2(x) bind(c,name="xyz")9 integer, intent(in) :: x10end subroutine11 12subroutine global3(x)13 integer, intent(in) :: x14end subroutine15 16pure subroutine global4(x)17 integer, intent(in) :: x18end subroutine19 20subroutine global5(x)21 integer, intent(in) :: x22end subroutine23 24! Regression check: don't emit bogus "Implicit declaration of function 'global7' has a different result type than in previous declaration"25recursive function global6()26 integer global6, z, n27entry global7(n) result(z)28 if (n > 0) z = global7(n-1)29end function30 31program test32 interface33 !WARNING: The global subprogram 'global1' is not compatible with its local procedure declaration (incompatible dummy argument #1: incompatible dummy data object types: INTEGER(4) vs REAL(4)) [-Wexternal-interface-mismatch]34 subroutine global1(x)35 real, intent(in) :: x36 end subroutine37 subroutine global2(x)38 real, intent(in) :: x39 end subroutine40 subroutine global3(x) bind(c,name="abc")41 real, intent(in) :: x42 end subroutine43 subroutine global4(x) ! not PURE, but that's ok44 integer, intent(in) :: x45 end subroutine46 !WARNING: The global subprogram 'global5' is not compatible with its local procedure declaration (incompatible procedure attributes: Pure) [-Wexternal-interface-mismatch]47 pure subroutine global5(x)48 integer, intent(in) :: x49 end subroutine50 function global6()51 integer global652 end function53 function global7(n) result(z)54 integer n, z55 end function56 end interface57end58