[Bug fortran/44582] gfortran generates wrong results due to wrong ABI in function with array return
kargl at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jun 18 19:11:00 GMT 2010
------- Comment #5 from kargl at gcc dot gnu dot org 2010-06-18 19:10 -------
(In reply to comment #4)
> O.K. I doublechecked the standard. The array declared does not need to be
> initialized in this case. So the return value could be any number. However,
> this kind of implementation should fail in a certian case. I am trying to write
> a small example to prove this. I will post it later.
>
Well, actually the array needs to be initialized, but not
by the compiler. It is the responsibility of the programmer
to initialize his/her variables. Techincally, your function
is invalid because
function ddx(array)
implicit double precision (a-h,o-z)
double precision:: array(:,:)
double precision:: ddx(size(array,dim=1),size(array,dim=2))
print *, ddx(1,1)
end function ddx
the print statement references an undefined variable. See section
16.5.1:
(1) An array is defined if and only if all of its elements are defined.
A careful reading of 16.5 might be useful.
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44582
More information about the Gcc-bugs
mailing list