------- Comment #61 from pault at gcc dot gnu dot org 2007-11-16 09:23 ------- Richard,
I believe that this is the right outcome for achar_4? (*(char[0:][1:1] *) atmp.4.data)[S.5][1]{lb: 1 sz: 1} = *(_gfortran_ compare_string (D.529, &(*(char[0:][1:1] *) atmp.2.data)[S.5][1]{lb: 1 sz: 1}, 1 , &"a"[1]{lb: 1 sz: 1}) >= 0 && _gfortran_compare_string (D.541, &(*(char[0:][1: 1] *) atmp.3.data)[S.5][1]{lb: 1 sz: 1}, 1, &"z"[1]{lb: 1 sz: 1}) <= 0 ? &char.6 : &(*(char[0:][1:1] *) atmp.1.data)[S.5][1]{lb: 1 sz: 1}); Obtained with the following, not yet regtested, patch: Index: gcc/fortran/trans-array.c =================================================================== *** gcc/fortran/trans-array.c (révision 130174) --- gcc/fortran/trans-array.c (copie de travail) *************** gfc_conv_expr_descriptor (gfc_se * se, g *** 4734,4748 **** gfc_add_block_to_block (&block, &rse.pre); gfc_add_block_to_block (&block, &lse.pre); ! if (TREE_CODE (rse.expr) != INDIRECT_REF) ! { ! lse.string_length = rse.string_length; ! tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, true, ! expr->expr_type == EXPR_VARIABLE); ! gfc_add_expr_to_block (&block, tmp); ! } ! else ! gfc_add_modify_expr (&block, lse.expr, rse.expr); /* Finish the copying loops. */ gfc_trans_scalarizing_loops (&loop, &block); --- 4734,4743 ---- gfc_add_block_to_block (&block, &rse.pre); gfc_add_block_to_block (&block, &lse.pre); ! lse.string_length = rse.string_length; ! tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, true, ! expr->expr_type == EXPR_VARIABLE); ! gfc_add_expr_to_block (&block, tmp); /* Finish the copying loops. */ gfc_trans_scalarizing_loops (&loop, &block); Index: gcc/fortran/trans-expr.c =================================================================== *** gcc/fortran/trans-expr.c (révision 130174) --- gcc/fortran/trans-expr.c (copie de travail) *************** gfc_conv_string_parameter (gfc_se * se) *** 3597,3604 **** type = TREE_TYPE (se->expr); if (TYPE_STRING_FLAG (type)) { ! gcc_assert (TREE_CODE (se->expr) != INDIRECT_REF); ! se->expr = gfc_build_addr_expr (pchar_type_node, se->expr); } gcc_assert (POINTER_TYPE_P (TREE_TYPE (se->expr))); --- 3597,3611 ---- type = TREE_TYPE (se->expr); if (TYPE_STRING_FLAG (type)) { ! if (TREE_CODE (se->expr) != INDIRECT_REF) ! se->expr = gfc_build_addr_expr (pchar_type_node, se->expr); ! else ! { ! type = gfc_get_character_type_len (gfc_default_character_kind, ! se->string_length); ! type = build_pointer_type (type); ! se->expr = gfc_build_addr_expr (type, se->expr); ! } } gcc_assert (POINTER_TYPE_P (TREE_TYPE (se->expr))); I am just putting it on to regtest now. I am rather convinced that it will cause some regressions but that it is the right way to go. We'll see! Cheers Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31608