http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54286



--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> 2013-01-09 09:44:07 
UTC ---

Please find below my interpretation of the validity or not of the testcase for

this PR.



> The following test is probably invalid, but not rejected by recent trunk

> versions:

> 

> 

> type :: t

>   procedure(a), pointer, nopass :: p

> end type

> 

> type(t) :: x

> procedure(iabs), pointer :: pp

> 

> x%p => a     ! ok



[A] I believe that this is invalid because the interfaces do not match

procedure(iabs), pointer  =>  integer pointer procedure (integer formal)



It strikes me as being a moot point as to whetehr or not the processor is

required to report it though, on the gorunds that "anything goes" with

pointers! That said, the interface check is easy to implement.



> x%p => a(1)  ! invalid, but not rejected by 4.8



[B] This is valid:

procedure(iabs), pointer  =>  pointer to integer procedure(iabs)



It has the pleasing property of providing the correct result for

print *, x%p(-99) .eq. iabs(-99)



> 

> pp => a(2)   ! ok



[B] applies - it also gives the correct result.



> pp => a      ! invalid, but not rejected by 4.8



[A] applies - invalid.



> 

> contains

> 

>   function a (c) result (b)

>     integer, intent(in) :: c

>     procedure(iabs), pointer :: b

>     b => iabs

>   end function

> 

> end



Interestingly, both invalid lines run and provide results that are consistent

with INT (loc (iabs)) :-)



Paul

Reply via email to