Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: oliveria@srvr1 (Roque Donizete de Oliveira,,,)
Subject: Re: DEC Fortran 3.04 optimizes away PARAMETER variables
Date: 27 Dec 91 19:45:05 GMT	[thread overview]
Message-ID: <hp4_xYA@engin.umich.edu> (raw)
In-Reply-To: kku5cuINN46m@grapevine.EBay.Sun.COM

From article <kku5cuINN46m@grapevine.EBay.Sun.COM>, by smckinty@sunicnc.France.Sun.COM (Steve McKinty - Sun ICNC):
> In article <rfz_0G_@engin.umich.edu>, oliveria@engin.umich.edu (Roque Donizete de Oliveira) writes:
>    > I'm using a decstation5000 running Ultrix 4.2 with DEC Fortran
>    > version 3.04 and dbx version 2.10.1.
>    > I've compiled the file below as
>    >                                 f77 -g2 -O0 junk.f
>    > then I ran 
>    >             dbx a.out
>    > 
>    > The problem is that it seems the DEC Fortran compiler optimizes away
>    > the PARAMETER declaration. I want the debugger to know about
>    > variables in the PARAMETER statement (so I can examine them within
>    > the debugger). Is there any of accomplishing this (through other 
>    > compilation flags or perhaps a newer version of DEC Fortran) ?
>    > 
>    > C-----------------------------junk.f-----------------------------
>    >       PARAMETER (R=1.2)
>    >       print *,'Enter x'
>    >       read (*,*) x
>    >       y=sin(x*r)
>    >       stop
>    >       end
>    > C----------------------------------------------------------------
>    > 
> 
> PARAMETER declarations aren't variables, they are pretty much like the
> #define in C but more limited, i.e. really just handled at a textual
> level. The compiler just replaces the R with 1.2, then compiles the program.
> I doubt if any compiler will propagate the names in a parameter statement
> to debug. You would need to replace it with an actual variable R, possibly
> filled by a DATA statement to get the same effect. Then youshould
> be able to see it in a debugger.
> 
> Bear in mind that since PARAMETER values are fixed constants, they
> can't change, so you shouldn't really need to look at them with a
> debugger.
> 
> 
> -- 
> Steve McKinty
> SUN Microsystems ICNC
> 38240 Meylan, France
> email: smckinty@france.sun.com	   BIX: smckinty

By using the MIPS compiler (available with ultrix 3.1d) and dbx I can
print the value of something declared in a PARAMETER statement.
The same is true if I use Apollo's f77 compiler and dbx.
I understand there should be no need to examine something
declared in a PARAMETER statement but when you are debugging a
large code you try to print even known variables just to make sure
something weird didn't happened (like losing its value due to a stack
problem).

I realize this problem (Ultrix 4.2 with DEC Fortran version 3.04 and 
dbx version 2.10.1 cannot print PARAMETER "variables") may not be an
important one but it is something that could be fixed in the next release.

Thanks.

        Roque
        oliveria@caen.engin.umich.edu


       reply	other threads:[~1991-12-27 19:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <kku5cuINN46m@grapevine.EBay.Sun.COM>
1991-12-27 19:45 ` Roque Donizete de Oliveira,,, [this message]
1991-12-28  4:31   ` DEC Fortran 3.04 optimizes away PARAMETER variables Stephen Tihor
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox