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/gfortran] Fix for PR16939


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


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