This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch/gfortran] Empty array constructors
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Erik Edelmann <eedelman at acclab dot helsinki dot fi>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 04 Jun 2005 00:39:51 +0200
- Subject: Re: [Patch/gfortran] Empty array constructors
- References: <20050603222143.GA10788@acclab.helsinki.fi>
Erik Edelmann wrote:
> Index: gcc/fortran/array.c
> ===================================================================
> RCS file: /cvsroot/gcc/gcc/gcc/fortran/array.c,v
> retrieving revision 1.15
> diff -r1.15 array.c
> 890c890
> < goto empty; /* Special case */
> ---
>
>> goto syntax;
>
> 914d913
> < empty:
I changed this to give a more expressive error message and adapted the
testcase accordingly. In the future, please use a readable diff format
(either 'cvs diff -up' or 'cvs diff -c3p'). In this case it was easy to
figure out where the patch had to go, but usually context and line numbers are
quite helpful for humans :-)
I will commit this once testing finishes.
Thanks,
- Tobi
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.
Index: array.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/array.c,v
retrieving revision 1.15
diff -u -p -r1.15 array.c
--- array.c 18 May 2005 19:20:14 -0000 1.15
+++ array.c 3 Jun 2005 22:38:15 -0000
@@ -887,7 +887,10 @@ gfc_match_array_constructor (gfc_expr **
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 **
if (gfc_match (end_delim) == MATCH_NO)
goto syntax;
-empty:
expr = gfc_get_expr ();
expr->expr_type = EXPR_ARRAY;