[Patch, fortran] PR31692 - Wrong code when passing function name as result to procedures
FX Coudert
fxcoudert@gmail.com
Mon May 7 21:14:00 GMT 2007
>> 2007-05-04 Paul Thomas <pault@gcc.gnu.org>
>>
>> PR fortran/31292
>> * trans-array.c (gfc_conv_array_parameter): Convert full
>> array
>> references to the result of the procedure enclusing the call.
OK with the following whitespace change:
> + if (this_array_result)
> + {
> + if (g77 == 1 && TREE_TYPE (TREE_TYPE (se->expr)) != NULL_TREE
> + && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (se->expr))))
> + se->expr = gfc_conv_array_data (build_fold_indirect_ref (se-
> >expr));
Mis-indentation of this last line?
I think "g77 && ..." would be way better than "g77 == 1 && ...". E.g.
I spent some time to look if g77 could have other integer values (the
all too common magical values
> + /* Is this the result of the enclosing procedure? */
> + this_array_result = (full_array_var && sym->attr.flavor ==
> FL_PROCEDURE);
> + if (this_array_result)
> + {
> + this_array_result = (sym->backend_decl ==
> current_function_decl);
> + this_array_result |= (sym->backend_decl == parent);
> + }
Why not the following?
+ /* Is this the result of the enclosing procedure? */
+ if (full_array_var && sym->attr.flavor == FL_PROCEDURE)
+ this_array_result = sym->backend_decl == current_function_decl
+ || sym->backend_decl == parent;
+ else
+ this_array_result = false;
Other than that, it's OK for me. The preexisting logic of this code
is not crystal-clear, but hopefully we won't have it to change it
every other day! :)
FX
More information about the Fortran
mailing list