there seems to be a problem in the handling of optional
arguments, and i am not shure, whether my understanding is
false or some compilers work incorrect.
If i declare some arguments of a library-function as
optional arguments with assumed shape and in all subroutines
called by this
library too, some compilers dump a core-file, some
work as espected.
To clarify the situation a very simple example follows.
!! begin file
program test
integer:: i=1
external funsub
call testsub1(funsub,i)
contains
subroutine testsub1(f,i,j)
integer:: i
integer,optional:: j(:)
external f
call f(i,j)
end subroutine testsub1
end program test
subroutine funsub(i)
integer:: i
write(*,*)'i=',i
end subroutine funsub
!! end file
This small code dumps a core on a SGI (V7.2) and
SUN (f90 WorkShop Compilers 4.2), but runs fine on a
HP (f90 V1.0) and AIX (xlf90).
With a small change of the optional argument from
assumed shape ( j(:) ) to assumed size ( j(*) ) everything
work as expected.
(it doesn't matter if i declare the optional argument as a
dummy argument in the called subroutine 'funsub' or not)
Is this a compiler-bug (SGI,SUN) or a feature (HP,AIX)??
Olaf
--
Olaf Michelsson mailto:[log in to unmask]
Faculty E/I Dept. of Theoretical Electrical Engineering
Technical University of Ilmenau, Germany
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|