This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR31879 , PR31197 , PR31258 & PR32703 - various character problems



Hi Paul,


I have a few minor observations, apart from which the patch looks ok. Since FX is giving it a through review while I've only scanned through the patch, and since it's difficult stuff please wait for his comments before proceeding.

Paul Thomas wrote:
*************** gfc_conv_function_call (gfc_se * se, gfc
*** 2279,2286 ****
&& fsym->as->type != AS_ASSUMED_SHAPE;
f = f || !sym->attr.always_explicit;
! if (e->expr_type == EXPR_VARIABLE
! && is_aliased_array (e))
/* The actual argument is a component reference to an
array of derived types. In this case, the argument
is converted to a temporary, which is passed and then
--- 2255,2261 ----
&& fsym->as->type != AS_ASSUMED_SHAPE;
f = f || !sym->attr.always_explicit;
! if (e->expr_type == EXPR_VARIABLE && is_aliased_array (e))
/* The actual argument is a component reference to an
array of derived types. In this case, the argument
is converted to a temporary, which is passed and then

This hunk is unrelated and not mentioned in the ChangeLog.


Index: gcc/fortran/resolve.c
===================================================================
*** gcc/fortran/resolve.c (revision 127610)
--- gcc/fortran/resolve.c (working copy)
*************** resolve_substring (gfc_ref *ref)
*** 3531,3536 ****
--- 3531,3598 ----
}
+ /* This function supplies missing substring charlens. */
+ + void
+ gfc_resolve_substring_charlen (gfc_expr *e)
+ {
+ gfc_ref *char_ref = e->ref;
+ gfc_expr *start, *end;
+ + for (; char_ref; char_ref = char_ref->next)
+ if (char_ref->type == REF_SUBSTRING)
+ break;
+ + if (!char_ref)
+ return;

Stylistically, I don't like the initialization of char_ref outside of the for header since it's part of the loop logic. Further, it probably makes sense to assert that the reference is indeed the last in the chain.


*************** gfc_resolve_expr (gfc_expr *e)
*** 3933,3938 ****
--- 4032,4041 ----
if (t == SUCCESS)
expression_rank (e);
}
+ + if (e->ts.type && e->ref && e->ref->type != REF_SUBSTRING)
+ gfc_resolve_substring_charlen (e);
+ break;
case EXPR_SUBSTRING:

I'm fairly sure that you want to compare "e->ts.type" with some enum value, such as BT_CHARACTER.


Thanks,
- Tobi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]