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

Daniel Kraft d@domob.eu
Sat Sep 6 13:26:00 GMT 2008


Tobias Burnus wrote:
> 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.)

Hi Tobias,

thanks for your thoughts!  Do you think we should add the program as new 
(succeeding) test case?

Daniel

-- 
Done:     Arc-Bar-Cav-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal
To go:    Hea-Kni-Mon-Pri-Ran-Rog-Tou



More information about the Fortran mailing list