Weird compiler problem with g77
Joseph Mildenberger
Joe.Mildenberger@triumf.ca
Wed Apr 25 15:21:00 GMT 2001
Hi,
I just noticed that my message did not contain the original
description of the problem that I posted to comp.lang.fortran .
Joe
Joseph Mildenberger wrote:
>
> Here is a very strange problem encountered running a g77-compiled
> program under Redhat 6.2.
>
> A certain routine has the following statement:
>
> RIN1 = -5.375732e+00
> > +(6.633470e+00) * OUT1
> > +(-4.439595e-01) * OUT2
> > +(7.969399e-02) * OUT3
> > +(4.069703e+00) * OUT4
> > +(-1.356189e+00) * OUT5
>
> The variables OUT1, OUT2, etc., are all REALS, and all of O(1)
> magnitude. When the routine in which the line resides is called twice
> for the same set of arguments OUT1, OUT2, etc., the result for RIN1 is
> correct the first time, but second time through, RIN1 is NAN. When
> called _again_, for a new set of OUT1, OUT2, etc., this pattern repeats
> itself, i.e. correct the first time, NAN the second time.
>
> I have verified that OUT1, OUT2, etc., are not being overwritten between
> the 1st and 2nd calls to the routine. Further, if the hard-coded
> constants are placed in an array and initialized via a DATA statement,
> i.e.
>
> REAL P(6)
> DATA P/-5.375732e+00,6.633470e+00,-4.439595e-01,7.969399e-02,
> + 4.069703e+00,-1.356189e+00/
>
> <...>
>
> RIN1 = P(1)+P(2)*OUT1+P(3)*OUT2+P(4)*OUT3+P(5)*OUT4+P(6)*OUT5
>
> the strange behaviour does _not_ occur. Also, the exact same code,
> compiled on an SGI under IRIX 6.5 does not exhibit this behaviour.
>
> Can anyone suggest ideas on how to track down the root of this problem?
>
> Thanks,
> Joe
More information about the Gcc-bugs
mailing list