This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch,fortran] Accept noninteger exponents in initialization expressions for Fortran 2003 (PR29962)

:ADDPATCH fortran:

Fortran 2003 allows much more in initialization expressions than Fortran
95 (cf. PR29962), some of which are support in STD_GNU.

This patch allows noninteger exponents in initialization expressions.
The relevant parts of the standard are:

"7.1.7 Initialization expression" in Fortran 2003 and in the Section
" Constant expression" in Fortran 95.

F95: "An initialization expression is a constant expression in which the
exponentiation operation is
permitted only with an integer power"

In F2003 this clause is gone.

Regression tested on x86_64-unknown-linux-gnu.


2006-11-27  Tobias Burnus  <>

    PR fortran/29962
    * expr.c (check_intrinsic_op): Allow noninteger exponents for F2003.
Index: gcc/fortran/expr.c
--- gcc/fortran/expr.c	(Revision 119247)
+++ gcc/fortran/expr.c	(Arbeitskopie)
@@ -1622,8 +1622,10 @@
       if (e->value.op.operator == INTRINSIC_POWER
 	  && check_function == check_init_expr && et0 (op2) != BT_INTEGER)
-	  gfc_error ("Exponent at %L must be INTEGER for an initialization "
-		     "expression", &op2->where);
+	  if (gfc_notify_std (GFC_STD_F2003,"Fortran 2003: Noninteger "
+			      "exponent in an initialization "
+			      "expression at %L", &op2->where)
+	      == FAILURE)
 	  return FAILURE;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]