[patch, libfortran] Fix PR 34980
Tobias Burnus
tobias.burnus@physik.fu-berlin.de
Mon Jan 28 09:23:00 GMT 2008
> In the PR, there is a comment from Tobias B. with an alternate approach.
> I was already into testing my patch when I read that comment, which is
> why I didn't pursue that approach further. I have to admit that I feel
> better about adding something that's obviously (to me) correct to a
> library function than to do this in the front end.
The patch Thomas mentions is:
Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c (Revision 131876)
+++ gcc/fortran/simplify.c (Arbeitskopie)
@@ -3714,7 +3714,11 @@ gfc_simplify_shape (gfc_expr *source)
int n;
try t;
- if (source->rank == 0 || source->expr_type != EXPR_VARIABLE)
+ if (source->rank == 0)
+ return gfc_start_constructor (BT_INTEGER, gfc_default_integer_kind,
+ &source->where);
+
+ if (source->expr_type != EXPR_VARIABLE)
return NULL;
result = gfc_start_constructor (BT_INTEGER, gfc_default_integer_kind,
As explanation one should add that SHAPE always returns a rank-one
array. This array is empty for scalars.
I find it that patch also obvious ;-)
Tobias,
who will bootstrap/regtest his patch tomorrow.
More information about the Fortran
mailing list