109 lines · plain
1! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s2! Tests rules of 15.5.5.2 for generics and explicit intrinsics3! competing at various scoping levels.4module m15 private6 public abs7 interface abs8 module procedure :: abs_int_redef, abs_noargs9 end interface10contains11 integer function abs_int_redef(j)12 integer, intent(in) :: j13 abs_int_redef = j14 end function15 integer function abs_noargs()16 abs_noargs = 017 end function18end module19 20module m221 private22 public abs23 interface abs24 module procedure abs_real_redef25 end interface26contains27 real function abs_real_redef(x)28 real, intent(in) :: x29 abs_real_redef = x30 end function31end module32 33module m334 use m1, only: abs35 implicit none36contains37 subroutine test138 use m2, only: abs39 !CHECK: abs_int_redef(40 print *, abs(1)41 !CHECK: abs_real_redef(42 print *, abs(1.)43 !CHECK: 1.41421353816986083984375_444 print *, abs((1,1))45 !CHECK: abs_noargs(46 print *, abs()47 end subroutine48 subroutine test249 intrinsic abs ! override some of module's use of m150 block51 use m2, only: abs52 !CHECK: 1_453 print *, abs(1)54 !CHECK: abs_real_redef(55 print *, abs(1.)56 !CHECK: 1.41421353816986083984375_457 print *, abs((1,1))58 !CHECK: abs_noargs(59 print *, abs()60 end block61 end subroutine62 subroutine test363 interface abs64 module procedure abs_complex_redef ! extend module's use of m165 end interface66 !CHECK: abs_int_redef(67 print *, abs(1)68 !CHECK: 1._469 print *, abs(1.)70 !CHECK: abs_complex_redef(71 print *, abs((1,1))72 !CHECK: abs_noargs(73 print *, abs()74 block75 intrinsic abs ! override the extension76 !CHECK: 1.41421353816986083984375_477 print *, abs((1,1))78 end block79 end subroutine80 real function abs_complex_redef(z)81 complex, intent(in) :: z82 abs_complex_redef = z83 end function84 subroutine test485 !CHECK: abs(86 print *, abs(1)87 contains88 integer function abs(n) ! override module's use of m189 integer, intent(in) :: n90 abs = n91 end function92 end subroutine93end module94 95module m496 contains97 integer function abs(n)98 integer, intent(in) :: n99 abs = n100 end function101 subroutine test5102 interface abs103 module procedure abs ! same name, host-associated104 end interface105 !CHECK: abs(106 print *, abs(1)107 end subroutine108end module109