[gfortran] Fix PR 15211

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Mon May 31 22:03:00 GMT 2004


Looking again at the code in gfc_conv_intrinsic_len it occurred to me 
that all strings in an array must be of the same length. Therefor this 
one line fix should do the trick. The test for arg->ref == NULL is 
clearly meant to separate the case of arg->ref == REF_SUBSTRING, but is 
meaningless in the case of REF_ARRAY or REF_COMPONENT (which I will look 
into after this is approved).

- Tobi

2004-05-31  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

	* trans-intrinsic.c (gfc_conv_intrinsic_len): Deal with arrays
	of strings.

Index: trans-intrinsic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-intrinsic.c,v
retrieving revision 1.5
diff -u -p -r1.5 trans-intrinsic.c
--- trans-intrinsic.c   14 May 2004 15:32:01 -0000      1.5
+++ trans-intrinsic.c   31 May 2004 18:48:57 -0000
@@ -1874,7 +1874,8 @@ gfc_conv_intrinsic_len (gfc_se * se, gfc
        break;

      default:
-       if (arg->expr_type == EXPR_VARIABLE && arg->ref == NULL)
+       if (arg->expr_type == EXPR_VARIABLE
+           && (arg->ref == NULL || arg->ref->type == REF_ARRAY))
           {
             sym = arg->symtree->n.sym;
             decl = gfc_get_symbol_decl (sym);



More information about the Gcc-patches mailing list