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] PR31803 - Fix pointer => target(range)


Tobias Burnus wrote:
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c (Revision 124415)
+++ gcc/fortran/expr.c (Arbeitskopie)
@@ -2553,6 +2553,7 @@ gfc_check_pointer_assign (gfc_expr *lval
return SUCCESS;
if (lvalue->ts.type == BT_CHARACTER
+ && lvalue->ts.cl && rvalue->ts.cl
&& lvalue->ts.cl->length && rvalue->ts.cl->length
&& abs (gfc_dep_compare_expr (lvalue->ts.cl->length,
rvalue->ts.cl->length)) == 1)

I just had the following idea for a beginner's project: we could get rid of these double-checks by having a global gfc_charlen gfc_empty_cl, whose length member would be initialized to NULL (happens automatically, as it's in global storage). Then, instead of zeroing ts.cl if the charlen is not known, we would make it point to &gfc_empty_cl. Then ts.cl would never be NULL, and ts.cl->length == NULL would be necessary and sufficient for an unknown length.


Cheers,
- Tobi


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