array.c (gfc_match_array_constructor): Disallow empty array constructor.
authorTobias Schlüter <tobi@gcc.gnu.org>
Sat, 4 Jun 2005 10:26:57 +0000 (12:26 +0200)
committerTobias Schlüter <tobi@gcc.gnu.org>
Sat, 4 Jun 2005 10:26:57 +0000 (12:26 +0200)
fortran/
2005-06-03  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
Erik Edelmann  <erik.edelmann@iki.fi>

* array.c (gfc_match_array_constructor): Disallow empty array
constructor.
testsuite/
2005-06-04  Erik Edelmann  <erik.edelmann@iki.fi>

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

From-SVN: r100579

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

index 8327b51b763b6590983ae8e34996a10023c6306f..bc0fa79d7de78b0352e8549fcf11b02e565c0c07 100644 (file)
@@ -1,3 +1,9 @@
+2005-06-03  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+       Erik Edelmann  <erik.edelmann@iki.fi>
+
+       * array.c (gfc_match_array_constructor): Disallow empty array
+       constructor.
+
 2005-06-03  Jerry DeLisle <jvdelisle@verizon.net>
 
        * fortran/intrinsic.texi: Add documentation for
index f6284408567e1d136a367277e74172e36484f3be..3d90a55833f934464b682d5d0f5dc4e2f2a74903 100644 (file)
@@ -887,7 +887,10 @@ gfc_match_array_constructor (gfc_expr ** result)
   head = tail = NULL;
 
   if (gfc_match (end_delim) == MATCH_YES)
-    goto empty;                        /* Special case */
+    {
+      gfc_error ("Empty array constructor at %C is not allowed");
+      goto cleanup;
+    }
 
   for (;;)
     {
@@ -911,7 +914,6 @@ gfc_match_array_constructor (gfc_expr ** result)
   if (gfc_match (end_delim) == MATCH_NO)
     goto syntax;
 
-empty:
   expr = gfc_get_expr ();
 
   expr->expr_type = EXPR_ARRAY;
index 78a2f5714603c74a054c6cba9ffc17869c995483..acbdca22ea264529bf6c7b2771c79ab7a7ee36a5 100644 (file)
@@ -1,3 +1,7 @@
+2005-06-04  Erik Edelmann  <erik.edelmann@iki.fi>
+
+       * gfortran.dg/array_constructor_3.f90: New test.
+
 2005-06-04  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
 
        * gfortran.dg/ret_pointer_1.f90: Un-XFAIL.
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_3.f90 b/gcc/testsuite/gfortran.dg/array_constructor_3.f90
new file mode 100644 (file)
index 0000000..7ddd1f4
--- /dev/null
@@ -0,0 +1,5 @@
+! { dg-do compile }
+! Check that empty array constructors are rejected
+program hum
+    print *, (//)  { dg-error "Empty array constructor" }
+end program hum