This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR31803 - Fix pointer => target(range)
- From: Tobias Schlüter <Tobias dot Schlueter at physik dot uni-muenchen dot de>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Fri, 04 May 2007 15:31:50 +0200
- Subject: Re: [Patch, fortran] PR31803 - Fix pointer => target(range)
- References: <463B2A73.70703@net-b.de>
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