* Re: DEC Fortran 3.04 optimizes away PARAMETER variables
[not found] <kku5cuINN46m@grapevine.EBay.Sun.COM>
@ 1991-12-27 19:45 ` Roque Donizete de Oliveira,,,
1991-12-28 4:31 ` Stephen Tihor
0 siblings, 1 reply; 2+ messages in thread
From: Roque Donizete de Oliveira,,, @ 1991-12-27 19:45 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: DEC Fortran 3.04 optimizes away PARAMETER variables
1991-12-27 19:45 ` DEC Fortran 3.04 optimizes away PARAMETER variables Roque Donizete de Oliveira,,,
@ 1991-12-28 4:31 ` Stephen Tihor
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Tihor @ 1991-12-28 4:31 UTC (permalink / raw)
But it really isn;t a bug, parameters are macro level things and
I usually have problems getting unix debugs to tell me about C macros.
It is a useful idea to snarf them away somewhere so that they can be view
but not modified but its not a bug its a featuer you want added.
Try submitting a suggestion SPR.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1991-12-28 4:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <kku5cuINN46m@grapevine.EBay.Sun.COM>
1991-12-27 19:45 ` DEC Fortran 3.04 optimizes away PARAMETER variables Roque Donizete de Oliveira,,,
1991-12-28 4:31 ` Stephen Tihor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox