This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: why a parameter changes when transfered to subroutine
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Jerry DeLisle <jvdelisle at verizon dot net>
- Cc: fanbin <fan dot wisdom at gmail dot com>, fortran at gcc dot gnu dot org
- Date: Fri, 27 Jul 2007 22:15:35 -0700
- Subject: Re: why a parameter changes when transfered to subroutine
- References: <11839809.post@talk.nabble.com> <46AACED7.5080808@verizon.net>
On Fri, Jul 27, 2007 at 10:06:31PM -0700, Jerry DeLisle wrote:
> fanbin wrote:
> >I got a subroutine resh_dis(hubble,redshift,distance) which calculate this:
> >
> >distance = 1.0D0/hubble*redshift*3000000D0*(1+redshift/2)/((1+redshift)**2)
> >
> >in the subroutine all variables (including hubble ) were defined to be
> >real(kind=8), I admit that in the main program the hubble is real(kind=4)
> >like 62.0, than when I transfer it to the subroutine, the distance simply
> >become infinity, if I tranfered 62.0D0 instead of 62.0, everything becomes
> >fine, why? I use the gfortran compiler.
>
> Can you please send a working simplified example of the problem you are
> seeing? Need more information.
>
I think that we no more info. The OP is calling a subroutine
with a single precision actual argument and the subroutine is
expecting double precision. The argument stack is messed up.
--
Steve