This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g77 bug with const argument
- To: "Steven G. Kargl" <kargl at troutmask dot apl dot washington dot edu>
- Subject: Re: g77 bug with const argument
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Tue, 17 Aug 1999 21:37:37 +0200
- CC: craig at jcb-sc dot com, khan at xraylith dot wisc dot EDU, gcc-bugs at egcs dot cygnus dot com
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <199908171833.LAA36863@troutmask.apl.washington.edu>
Steven G. Kargl wrote:
> Once upon a time, craig@jcb-sc.com said:
> > Please just read the g77 docs thoroughly, especially the info on
> > non-bugs. You seem to be confusing *syntactic* correctness with
> > *correctness* itself. Also please review all sorts of related
> > discussions, as well as the FAQ, on comp.lang.fortran (USENET).
Although Steve himself used the phrase "syntactically correct", I think
the real issue is something else, namely, whether a subprogram in
isolation can be considered "Standard conforming".
subroutine b(a)
a = 10.
return
end
program main
write(*,*) 1.
call b(1.)
write(*,*) 1.
end
Both the program and the subprogram do not contain any non-conforming
constructs - in that sense they are "correct" (and not just
"syntactically correct"); it's only when they are combined that
non-conformance ensues.
The reason is that an actual argument passed to a subprogram that
modifies the corresponding dummy argument must be "definable"
(Fortranese for "being able to be assigned to"); IOW, it must be
something you can put on the left side of an assignment statement - this
is clearly not the case for the constant 1. above.
> The node non-bugs in g77.info does have anything to say about
> this problem.
>
> I read comp.lang.fortran daily.
The issue about Standard conformance for parts of a program vs. a
complete program was discussed about three weeks ago on
comp.lang.fortran. Dick Hendrickson claimed that one could only speak
about the conformance of "complete programs", not subprograms. However,
someone else pointed out that the Standard does not say this [Quoting
the first paragraph of Chapter 1.5 Conformance]:
<QUOTE>
A program (2.2.1) is a standard-conforming program if it uses only those
forms and relationships described herein and if the program has an
interpretation according to this standard. A program unit (2.2)
conforms to this standard if it can be included in a program in a manner
that allows the program to be standard conforming.
</QUOTE>
So my interpretation would be that both the main program and the
subroutine are standard-conforming, because both can be included in a
standard-conforming program, but the combination is not.
[ Note that "syntax" doesn't play a role in this reasoning ]
HTH,
--
Toon Moene (toon@moene.indiv.nluug.nl)
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Phone: +31 346 214290; Fax: +31 346 214286
GNU Fortran: http://world.std.com/~burley/g77.html
PS: This reminds me that I should send a patch to include a URL to
the relevant Standard for inclusion in our Readings section ...