------- Comment #7 from burnus at gcc dot gnu dot org 2009-10-09 21:59 ------- (In reply to comment #6) > idx=sum(maxloc(index(pfd%n,pfmt)))-1
The problem is that "pfd%n" is simplified to an array constructor [''] of type expr->value.constructor->ts == CHARACTER(kind=1,len=3). But this typespec is not propagated to expr->ts while doing the simplification and thus expr->ts is BT_DERIVED and expr->ts.kind == 0 - which causes the assert to trigger. If one applies the hack below, one continues a bit further but ends up having an ICE in gfc_conv_string_parameter's gcc_assert (POINTER_TYPE_P (TREE_TYPE (se->expr))) The proper solutions is presumably to find the spot in array.c or expr.c where the derived-type constructor is simplified into an character constructor; there at least updating the expr->ts is missing. Not working hack (ICE in gfc_conv_string_parameter): --- trans-intrinsic.c (Revision 152601) +++ trans-intrinsic.c (Arbeitskopie) @@ -5340,2 +5340,5 @@ gfc_conv_intrinsic_function (gfc_se * se case GFC_ISYM_INDEX: + if (expr->value.function.actual->expr->expr_type == EXPR_ARRAY) + expr->value.function.actual->expr->ts + = expr->value.function.actual->expr->value.constructor->expr->ts; kind = expr->value.function.actual->expr->ts.kind; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41044