assumed shape dummy arrays and implicit interfaces

Paul Thomas paulthomas2@wanadoo.fr
Wed Sep 14 04:54:00 GMT 2005


Tobi,

>
>
>What's the implicit case you're talking about in that obvious fix from earlier
>today?
>
It is this:

SUBROUTINE foo (x, i)
  REAL, DIMENSION(i:)       :: x
  integer                   :: i
  x (4) = 42.0
END SUBROUTINE foo

program test
  real, dimension(3)        :: y = 0
  integer                   :: j = 2

  call foo (y, j)
  print *, y
end program test

It segfaults at runtime in gfortran because the main programme does not 
know to provide a descriptor.


ifc (yes, it is called ifort too... both are present in the Intel 
distro.) gives ** Address Error ** at runtime and g95 the more 
informative Fortran runtime error: "Actual assumed-shape array argument 
does not conform", again at runtime.

I guess that the example is not implementable (nor is a compile time 
check!) but the standard does not disallow it, as far as I can tell.  I 
would be happy if somebody could point me to the place where it is 
forbidden.  My inclination is to add a runtime check to see if the 
assigned memory has the gfortran magic bootprint; if not, we emit an 
error like the others.  How do we assure that assumed shape dummys are 
not put on the stack?

Best regards

Paul

 



More information about the Fortran mailing list