This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: [Patch, Fortran] PR fortran/35837: Fix type-resolving and gfc_current_ns


Hi Daniel, hello Dominique,

using NAG f95, which is quite standard conforming and picky I get:
  Error: line 17: Reference to impure function ST2 from pure procedure U
where ST2 is an - in U defined - statement function.

gfortran 4.3 prints such an error for ST1, which is in the main
subroutine, which is not pure. I think it is obvious that that 4.3's
error message is wrong.

ifort's error seems to be also strange:
error #6404: This name does not have a type, and must have an explicit type.   [G]
      st1(i)=i*i*g(i)
-----------------^

openf95, g95, sunf95 and (now) gfortran 4.4 print no error.

On a first sight, NAG f95's error might be valid, but there is no
external, inpure reference and the standard explicitly has:

12.6 Pure procedures
A pure procedure is [...]
  (4) A statement function that references only pure functions

Thus:
  st2(i) = i*i
is pure and
  st1(i)=i*i*g(i)
is not.


In conclusion: I believe the program is valid and gfortran behaves
correctly. (Also for "st2(i)=g(i)" which is properly rejected.)

Tobias


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