[patch,fortran] Allow noninteger/noncharacter arguments to intrinsic functions for initialization expressions
Tobias Burnus
burnus@net-b.de
Thu Nov 23 22:23:00 GMT 2006
Hi,
since we started to emit an error with "-std=f95" rather than only with
"-pedantic -std=f95" if a noninteger/noncharacter argument is used in an
elemental intrinsic function in an initialization expressions, we don't
accept anymore:
-std=f2003
real, parameter :: a = acos(1.0)
This is therefore a kind of regression. (It is only a kind of regression
since we accepted it for the wrong reasons.)
Fortran 2003 standard states in
"7.1.7 Initialization expression":
[Allowed is] "a reference to an elemental standard intrinsic function,
where each argument is an initialization expression"
The Fortran 95 standard was stricter ("7.1.6.1 Constant expression"):
"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"
I attached a patch which changes GFC_STD_GNU to GFC_STF_F2003 and filled
PR 29962 as reminder to check whether there is indeed no difference
between GFC_STD_GNU and GFC_STF_F2003, to add a check whether the
intrinsic function is indeed elemental, etc.
Ok for the trunk?
Tobias
fortran/
2006-11-23 Tobias Burnus <burnus@net-b.de>
* intrinsic.c (gfc_intrinsic_func_interface): Allow
noninteger/nonreal arguments for intrinsics in initialization
expressions with -std=f2003.
testsuite/
2006-11-23 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/initialization_4.f90: Adapt dg-error.
* gfortran.dg/initialization_5.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: initialization.diff
Type: text/x-patch
Size: 1859 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061123/88365f0d/attachment.bin>
More information about the Gcc-patches
mailing list