This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/15273] [gfortran] Wrong output from a pure subroutine


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]