------- Comment #4 from dominiq at lps dot ens dot fr 2008-08-28 09:33 ------- It seems that some "attribute(s)" is(are) not properly (re)set. The following code
module myMod CONTAINS subroutine proc1(arg1, arg2, arg3) integer :: arg1, arg2, arg3 print*, arg1, arg2, arg3, 's ', arg1+arg2+arg3 end subroutine proc1 subroutine proc2(arg1, arg2, arg3) integer :: arg1, arg2, arg3 print*, arg1, arg2, arg3, 'p ', arg1*arg2*arg3 end subroutine proc2 real function proc3( arg1 ) integer :: arg1 proc3 = arg1+7 end function proc3 subroutine proc4( arg1 ) real, external :: arg1 print*, 'the func: ', arg1(0) end subroutine proc4 end module myMod program myProg use myMod PROCEDURE (), POINTER :: p => NULL() p => proc1 !1 call p(0, 2, 3) p => proc2 !2 call p(0, 2, 3) p => proc3 !3 call proc4( p ) !4 print*, 'the func: ', p(0) ! "Unexpected array reference" end program myProg compiles without error. If I remove the comments 1 to 4, I get the errors: pointer_subs.f90:30.31: print*, 'the func: ', p(0) ! "Unexpected array reference" 1 Error: FUNCTION attribute conflicts with SUBROUTINE attribute in 'p' at (1) pointer_subs.f90:29.16: call proc4( p ) 1 Error: Type/rank mismatch in argument 'arg1' at (1) If I remove comments 1 and 2 or comments 3 and 4, the program compiles without error and gives at run time respectively (after having applied the fix for pr37253): [ibook-dhum] f90/bug% a.out 0 2 3 s 5 0 2 3 p 0 [ibook-dhum] f90/bug% a.out the func: 7.0000000 the func: 7.0000000 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37254