This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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] PR31692 - Wrong code when passing function name as result to procedures


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


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