This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/15273] [gfortran] Wrong output from a pure subroutine
- From: "Tobias dot Schlueter at physik dot uni-muenchen dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 May 2004 14:00:47 -0000
- Subject: [Bug fortran/15273] [gfortran] Wrong output from a pure subroutine
- References: <20040504015650.15273.tcc@sentex.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From Tobias dot Schlueter at physik dot uni-muenchen dot de 2004-05-04 14:00 -------
Sorry, it looks like I switched paragraphs in the middle of reading the
standard. The code is LEGAL.
The first two constraints read correctly:
----
The /specification-part/ of a pure *function* subprogram shall specify that all
dummy arguments have INTENT(IN) except procedure arguments and arguments with
the POINTER attribute.
----
and
----
The /specification-part/ of a pure *subroutine* subprogram shall specify the
intents of all dummy arguments except procedure arguments, alternate return
indicators, and arguments with the POINTER attribute.
----
Come to think about it , this makes sense, as otherwise a pure subroutine
couldn't be very meaningful (and optimized away at will, as in this example).
For the curious, note 12.34 gives some insight into the logic behind this.
So it looks like the actual bug is that the middle-end is overly effective in
eliminating calls to pure functions.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15273