See:
http://groups.google.fr/group/comp.lang.fortran/browse_thread/thread/60c6758faf1762ad
Test case by Al Greynolds:
module bug
character(*),dimension(3),parameter :: a=(/'a() ','b(,) ','c(,,)'/)
integer,dimension(3),parameter :: l=len_trim(a),i=index(a,'(')
end
integer,dimension(3),parameter :: l=len_trim(a),i=index(a,'(')
1
Error: Extension: Evaluation of nonstandard initialization expression at (1)
Works with g95 -std=f95, NAG f95, ifort.
>From the standard (Craig Dedo):
Constant expressions and initialization expressions are defined in section
7.1.6.1 of 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 ... " in one of 9 categories of thingos.
One
of these categories is:
"(4) An elemental intrinsic function reference of type integer or character
where each argument is an initialization expression of type integer or
character;".
The function INDEX is defined in section 13.14.47 and the function LEN_TRIM
is defined in section 13.14.55. Both of these are in the class of elemental
functions. Therefore, both should be allowed in initialization expressions.
--
Summary: -std=f95 rejects len_trim() and index() in init
expressions
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=34915