[Patch/gfortran] Fix for PR16939

Paul Thomas paulthomas2@wanadoo.fr
Mon May 9 19:48:00 GMT 2005


This patch fixes PR16939, where dummy argument, scalar, character pointers 
were not correctly handled in pointer assignments.  An extra dose of 
dereferencing was applied in gfc_conv_variable, where other such cases are 
handled.

Bootstrapped and regtested on Cygwin_NT.  OK to commit? (Honest, it's all 
that I will commit!)

Paul T

2005-04-29  Paul Thomas  <pault@gcc.gnu.org>

 PR fortran/16939
 * trans-expr.c (gfc_conv_variable): Dereference dummy argument, scalar,
 character pointers so that pointer assignment works in this case.

$ 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 ----
          && !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 




More information about the Fortran mailing list