re PR fortran/33178 (-std=f95: SIGN with integer arguments rejected as initialization...
authorTobias Burnus <burnus@net-b.de>
Fri, 24 Aug 2007 19:26:42 +0000 (21:26 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Fri, 24 Aug 2007 19:26:42 +0000 (21:26 +0200)
2007-08-24  Tobias Burnus  <burnus@net-b.de>

PR fortran/33178
* intrinsic.c (gfc_intrinsic_func_interface): Fix initialization
expression check.

2007-08-24  Tobias Burnus  <burnus@net-b.de>

PR fortran/33178
* gfortran.dg/initialization_4.f90: Update dg-error.
* gfortran.dg/initialization_13.f90: New.

From-SVN: r127786

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

index 7ab6c1eddd7cc0d9d94daf9937ee123e01170c4e..95726ff159c80f92c00f9f0674e85ab1f2439b97 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-24  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/33178
+       * intrinsic.c (gfc_intrinsic_func_interface): Fix initialization
+       expression check.
+
 2007-08-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/32972
index 3f999b4210c8a30c6b12e2fcbb77562ba7c81a69..4128e441d6316f01bbff62e82996fa898c15dd2f 100644 (file)
@@ -3409,12 +3409,10 @@ got_specific:
      (4)   A reference to an elemental standard intrinsic function,
            where each argument is an initialization expression  */
 
-  if (gfc_init_expr 
-      && isym->elemental
-      && (expr->ts.type != BT_INTEGER || expr->ts.type != BT_CHARACTER)
-      && gfc_notify_std (GFC_STD_F2003, "Extension: Evaluation of "
-                       "nonstandard initialization expression at %L",
-                       &expr->where) == FAILURE)
+  if (gfc_init_expr && isym->elemental && flag
+      && gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Elemental function "
+                       "as initialization expression with non-integer/non-"
+                       "character arguments at %L", &expr->where) == FAILURE)
     return MATCH_ERROR;
 
   return MATCH_YES;
index 54da80e5169c7317f5bfcc735c5e89dbc418622c..11f33388bca4f1b9ddde7bc91bcdf055645a2407 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-24  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/33178
+       * gfortran.dg/initialization_4.f90: Update dg-error.
+       * gfortran.dg/initialization_13.f90: New.
+
 2007-08-24  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/33166
diff --git a/gcc/testsuite/gfortran.dg/initialization_13.f90 b/gcc/testsuite/gfortran.dg/initialization_13.f90
new file mode 100644 (file)
index 0000000..0cd6fa6
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR fortran/33178
+!
+! Initialization expressions:
+! Fortran 95: Elemental functions w/ integer/character arguments
+! Fortran 2003: restriction lifted
+!
+integer :: a = sign(1,1)   ! Ok F95
+real    :: b = sign(1.,1.) ! { dg-error "Fortran 2003: Elemental function as initialization expression" }
+end
index 552a01f8748376d7005347323072b3df113114e0..24ccf9c6457392d61a0cb4cd8476b96e7c28c430 100644 (file)
@@ -2,6 +2,6 @@
 ! initialization expression, even if -std=f95 was used
 ! { dg-do compile }
 ! { dg-options "-std=f95" }
-real, parameter :: pi = 4.0*Atan(1.0) ! { dg-error "Evaluation of nonstandard initialization expression" }
+real, parameter :: pi = 4.0*Atan(1.0) ! { dg-error "Fortran 2003: Elemental function as initialization expression" }
 real, parameter :: three = 27.0**(1.0/3.0) ! { dg-error "Noninteger exponent in an initialization expression" }
 end