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

           Summary: [F95+] Constant inquiry function rejected in PARAMETER
                    definition
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


I think the following program could be valid. It came up in an IR and my
understanding is that following program is valid - while the version in the IR
is invalid. -- Given that all other compilers accept it, I think it should be
valid F95.

Cf. http://j3-fortran.org/doc/year/11/11-101.txt - and look for updates
(11-101r1.txt etc.)

        INTEGER PURE FUNCTION F1(I)
          INTEGER :: A(int(1))
          INTEGER, PARAMETER :: KIND = SIZE(A)   ! KIND == 1
          INTEGER(KIND), INTENT(IN) :: I

          F1 = 17
        END FUNCTION F1

ifort, g95, NAG f95, pathf95 compile the program but gfortran rejects it with:

          INTEGER, PARAMETER :: KIND = SIZE(A)   ! KIND == 1
                                            1
Error: Array 'a' at (1) is a variable, which does not reduce to a constant
expression

Reply via email to