re PR fortran/33957 (gfortran rejects valid initialization expression)
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Fri, 16 Nov 2007 22:38:21 +0000 (22:38 +0000)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Fri, 16 Nov 2007 22:38:21 +0000 (22:38 +0000)
PR fortran/33957

* gfortran.dg/initialization_15.f90 : New test.

* expr.c (check_inquiry): Don't call gfc_error now.

From-SVN: r130246

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

index 57670b5a133014b0c895b84fe9e1d3cb6863f6d2..a889682316923c19a34c48b1a9d98d9072c04f32 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/33957
+       * expr.c (check_inquiry): Don't call gfc_error now.
+
 2007-11-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR fortran/33739
index c7edb49770258fa731c30b21fa4ba815db8dc058..22df1310df12786e5452851b3f25080400030644 100644 (file)
@@ -1981,11 +1981,7 @@ check_inquiry (gfc_expr *e, int not_restricted)
       break;
 
   if (functions[i] == NULL)
-    {
-      gfc_error ("Inquiry function '%s' at %L is not permitted "
-                "in an initialization expression", name, &e->where);
-      return MATCH_ERROR;
-    }
+    return MATCH_ERROR;
 
   /* At this point we have an inquiry function with a variable argument.  The
      type of the variable might be undefined, but we need it now, because the
index 5da0c1d878f36e90fccc33f3e4e11bda31872e4a..21761526653ea9b6290023942a1554bfe7652371 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-16  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/33957
+       * gfortran.dg/initialization_15.f90 : New test.
+
 2007-11-16  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/34030
diff --git a/gcc/testsuite/gfortran.dg/initialization_15.f90 b/gcc/testsuite/gfortran.dg/initialization_15.f90
new file mode 100644 (file)
index 0000000..a3eb1b9
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! Test by Dominique d'Humieres (PR 33957)
+function bug(i) result(c)
+  integer, pointer :: i
+  character(len=merge(1,2, associated(i))) :: c
+  c = ""
+end function bug