[Bug fortran/33178] New: -std=f95: SIGN with integer arguments rejected as initialization expression

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Aug 24 16:01:00 GMT 2007


Found at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/0019cb490586ed91/

SIGN with INTEGER arguments is allowed for initialization expressions in
Fortran 95; using REAL arguments it is only allowed for Fortran 2003.

gfortran -std=f95 prints the wrong error message for:

integer :: a = sign(1,1)
             1
Error: Extension: Evaluation of nonstandard initialization expression at (1)

For the following:
real :: a = sign(1.,1.)
          1
Error: Extension: Evaluation of nonstandard initialization expression at (1)

I would have expected "Error: Fortran 2003:".


>From the Fortran 95 standard:

"An initialization expression is a constant expression in which the
exponentiation operation is
permitted only with an integer power, and each primary is
[...]
(4) An elemental intrinsic function reference of type integer or character
where each
argument is an initialization expression of type integer or character,"


>From the Fortran 2003 standard:

"An initialization expression is an expression [...] in which each operation is
intrinsic, and each primary is [...]
(4) A reference to an elemental standard intrinsic function, where each
argument is an initialization expression
[...]
13.7.109 SIGN (A, B)
[...]
Class. Elemental function."


-- 
           Summary: -std=f95: SIGN with integer arguments rejected as
                    initialization expression
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: 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=33178



More information about the Gcc-bugs mailing list