The problem below arose when we were looking for a bug in a piece of
legacy code. We finally tracked it down. It is not the
scalar-versus-scalar element problem after all; the bug arises because
we pass an array slice to a subroutine with a contiguous (f77-like)
array dummy argument.
In the example below, the main program would look like this, for
example,
program main
use A
real :: b(10), c(10,10)
call sub( b(2:5) )
call sub( c(2:8, 2:5) )
end program
Our XLF compiler produces wrong results with this code. I have come
across many examples of this over . Is this allowed?
My feeling is that this may not be allowed, because you are passing a
f90 type array (ie, a slice) to a f77 dummy argument. But my 'feeling'
is not always right ;-)
Drew
On May 3, 2004, at 6:35 PM, Drew McCormack wrote:
> Is the following legal fortran 90?
>
>
> module A
> contains
> subroutine sub( array )
> real :: array(10)
> end subroutine
> end module
>
>
> program main
> use A
> real :: a, b(10), c(10,10)
> call sub(a)
> call sub(b)
> call sub(c)
> end program
>
>
> In other words, if you have an explicit interface, can you pass
> non-conforming arrays?
>
> Drew McCormack
>
========================================
Dr. Drew McCormack (Kmr. R153)
Afd. Theoretische Chemie
Faculteit Exacte Wetenschappen
Vrije Universiteit Amsterdam
De Boelelaan 1083
1081 HV Amsterdam
The Netherlands
Email [log in to unmask]
Telephone +31 20 44 47623
Mobile +31 6 483 21307
Fax +31 20 44 47629
|