]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/29962 (Initialization expressions)
authorTobias Burnus <burnus@net-b.de>
Mon, 4 Dec 2006 20:02:43 +0000 (21:02 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Mon, 4 Dec 2006 20:02:43 +0000 (21:02 +0100)
fortran/
2006-12-04  Tobias Burnus  <burnus@net-b.de>

PR fortran/29962
* expr.c (check_intrinsic_op): Allow noninteger exponents for F2003.

testsuite/
2006-12-04  Tobias Burnus  <burnus@net-b.de>

PR fortran/29962
* initialization_4.f90: Test noninteger exponents (-std=f95).
* initialization_5.f90: New test for noninteger exponents with -std=f2003

From-SVN: r119505

gcc/fortran/ChangeLog
gcc/fortran/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/initialization_4.f90
gcc/testsuite/gfortran.dg/initialization_5.f90 [new file with mode: 0644]

index 2ce1ec667f66a1cd8cebc32ab05c991a6eb1d952..eeaaa481b2a4b8be79470942d0ede7a0b2d79f46 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-04  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/29962
+       * expr.c (check_intrinsic_op): Allow noninteger exponents for F2003.
+
 2006-12-04  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/29821
index 16e89f85c264bcd4db2f1b79acbd62967b8dfbe8..f806497bc3886d9a98536cee46cd3bffc08a5ff3 100644 (file)
@@ -1622,9 +1622,11 @@ check_intrinsic_op (gfc_expr * e, try (*check_function) (gfc_expr *))
       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);
-         return FAILURE;
+         if (gfc_notify_std (GFC_STD_F2003,"Fortran 2003: Noninteger "
+                             "exponent in an initialization "
+                             "expression at %L", &op2->where)
+             == FAILURE)
+           return FAILURE;
        }
 
       break;
index a0c4f78d2277e086275d5a1e8b976647403ae64c..4ed0ce6d19a2b1a647f8f3b0cb4c0d52d7bdb470 100644 (file)
@@ -1,3 +1,10 @@
+2006-12-04  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/29962
+       * initialization_4.f90: Test noninteger exponents (-std=f95).
+       * initialization_5.f90: New test for noninteger exponents
+         with -std=f2003.
+
 2006-12-04  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/29821
index b0f24311bdb4815209d1f20a34fcc85e9427cafc..552a01f8748376d7005347323072b3df113114e0 100644 (file)
@@ -3,4 +3,5 @@
 ! { dg-do compile }
 ! { dg-options "-std=f95" }
 real, parameter :: pi = 4.0*Atan(1.0) ! { dg-error "Evaluation of nonstandard initialization expression" }
+real, parameter :: three = 27.0**(1.0/3.0) ! { dg-error "Noninteger exponent in an initialization expression" }
 end
diff --git a/gcc/testsuite/gfortran.dg/initialization_5.f90 b/gcc/testsuite/gfortran.dg/initialization_5.f90
new file mode 100644 (file)
index 0000000..b5cfe0f
--- /dev/null
@@ -0,0 +1,7 @@
+! initialization expression, now allowed in Fortran 2003
+! PR fortran/29962
+! { dg-do run }
+! { dg-options "-std=f2003 -fall-intrinsics" }
+  real, parameter :: three = 27.0**(1.0/3.0)
+  if(abs(three-3.0)>epsilon(three)) call abort()
+end