This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch/gfortran] Fix for PR16939
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Paul Thomas <paulthomas2 at wanadoo dot fr>
- Cc: patch <gcc-patches at gcc dot gnu dot org>, fortran at gcc dot gnu dot org
- Date: Mon, 09 May 2005 23:41:33 +0200
- Subject: Re: [Patch/gfortran] Fix for PR16939
- References: <006301c554d0$0b84f200$0400000a@Paul>
Paul Thomas wrote:
> Bootstrapped and regtested on Cygwin_NT. OK to commit? (Honest, it's all
> that I will commit!)
While this is right ...
> $ cvs diff -w -c3 -p gcc/gcc/fortran/trans-expr.c
> Index: gcc/gcc/fortran/trans-expr.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/fortran/trans-expr.c,v
> retrieving revision 1.42
> diff -w -c -3 -p -r1.42 trans-expr.c
> *** gcc/gcc/fortran/trans-expr.c 29 Apr 2005 15:31:33 -0000 1.42
> --- gcc/gcc/fortran/trans-expr.c 9 May 2005 19:39:20 -0000
> *************** gfc_conv_variable (gfc_se * se, gfc_expr
> *** 362,367 ****
> --- 362,374 ----
/* Dereference scalar dummy variables. */
if (sym->attr.dummy
&& sym->ts.type != BT_CHARACTER
> && !sym->attr.dimension)
> se->expr = gfc_build_indirect_ref (se->expr);
>
> + /* Dereference scalar dummy character pointers. */
> + if (sym->attr.dummy
> + && sym->attr.pointer
> + && sym->ts.type == BT_CHARACTER
> + && !sym->attr.dimension)
> + se->expr = gfc_build_indirect_ref (se->expr);
> +
> /* Dereference pointer variables. */
> if ((sym->attr.pointer || sym->attr.allocatable)
> && (sym->attr.dummy
|| sym->attr.result
|| sym->attr.function
|| !sym->attr.dimension)
&& sym->ts.type != BT_CHARACTER)
se->expr = gfc_build_indirect_ref (se->expr);
... I'm wondering if these interdependent conditions could be arranged more
clearly. The one you're adding is mutually exclusive with both of the others,
whereas the first one and the third one can both be true at the same time.
Maybe this is clearer:
/* Dereference scalar dummy variables. */
if (sym->attr.dummy
&& (sym->attr.pointer || sym->ts.type != BT_CHARACTER)
&& !sym->attr.dimension)
se->expr = gfc_build_indirect_ref (se->expr);
/* Dereference pointer variables a second time. */
if ((sym->attr.pointer || sym->attr.allocatable)
&& (sym->attr.dummy
|| sym->attr.result
|| sym->attr.function
|| !sym->attr.dimension)
&& sym->ts.type != BT_CHARACTER)
se->expr = gfc_build_indirect_ref (se->expr);
- Tobi