gfortran happily accepts the SAVE attribute for function (procedure attributes)

function sq(x)
  real, intent(in) :: x
  real, save :: sq  ! SAVE is wrong!
  sq = x**2
end function sq

g95:
Error: PROCEDURE attribute conflicts with SAVE attribute at (1)
sunf95:
ERROR: "SQ" is a function, therefore it must not be declared with the SAVE
attribute.
ifort:
The SAVE attribute conflicts with other declarations.
NAG f95:
Cannot SAVE procedure SQ


-- 
           Summary: Don't allow SAVE for functions
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29657

Reply via email to