Responding to this, I got a little surprise. With the following
MODULE m IMPLICIT NONE CONTAINS SUBROUTINE sub(proc) INTERFACE PURE FUNCTION proc(x) IMPLICIT NONE REAL, INTENT(IN) :: x REAL :: proc END FUNCTION proc END INTERFACE PRINT *, proc(0.0) END SUBROUTINE sub END MODULE m PROGRAM p USE m IMPLICIT NONE INTRINSIC :: sin CALL sub(sin) ! <-- Why "argument must be pure"? END PROGRAM p
the compiler complains about the purity of sin. Why?
>ifort /check:all /warn:all /standard-semantics passing-intrinsic.f90 && passing-intrinsic.exe Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 184.108.40.206 Build 20130728 Copyright (C) 1985-2013 Intel Corporation. All rights reserved. passing-intrinsic.f90(20): error #7892: Procedure argument must be PURE [SIN] CALL sub(sin) ! <-- Why "argument must be pure"? -----------^
This is unfamiliar territory for me, and ifort isn't alone in its complaint (gfortran complains too), so that makes me wonder what I've missed.
- "All standard intrinsic functions are pure" - F2008 13.1 p2.
- "If the interface of a dummy proceure is explicit, its characteristics as a procedure shall be the same as those of its effective argument, except... an elemental intrinsic actual procedure may be associated with a dummy procedure (which cannot be elemental)." - F2008 220.127.116.11 p1
- In F2008 13.6 the specific `sin` doesn't have a dot, so it can be an actual arg (F2008 C1235 and 18.104.22.168 p4).