As far as I can tell, the problem in 62242 (and possibly 62246) is with a 
string array constructor trying to deal with an array element whose value is a 
character function that is described in an interface block and which has an 
assumed-length result.  I can't claim more than a superficial understanding of 
the code, but this patch seems to work.  I ran make check-fortran, and I saw no 
regressions.

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog       (revision 226427)
+++ gcc/fortran/ChangeLog       (working copy)
@@ -1877,6 +1877,12 @@
        * interface.c (is_procptr_result): New function to check if an
        expression is a procedure-pointer result.
        (compare_actual_formal): Use it.
+
+2015_07-31
+
+       PR fortran/62242
+       * trans-array.c (gfc_add_loop_ss_code): String array constructor:
+       Don't try to convert string length unless it's constant.
 ^L
 Copyright (C) 2015 Free Software Foundation, Inc.
 
Index: gcc/fortran/trans-array.c
===================================================================
--- gcc/fortran/trans-array.c   (revision 226427)
+++ gcc/fortran/trans-array.c   (working copy)
@@ -2589,7 +2589,8 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss
          if (expr->ts.type == BT_CHARACTER
              && ss_info->string_length == NULL
              && expr->ts.u.cl
-             && expr->ts.u.cl->length)
+             && expr->ts.u.cl->length
+             && expr->ts.u.cl->length->expr_type == EXPR_CONSTANT)
            {
              gfc_init_se (&se, NULL);
              gfc_conv_expr_type (&se, expr->ts.u.cl->length,

Attachment: string_array_constructor_1.f90
Description: Binary data

Attachment: string_array_constructor_2.f90
Description: Binary data

Reply via email to