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]

[gfortran] Fix PR17678


The patch below fixes PR17678.

As noted in the PR, we're incorrectly generating initialization code for use 
associated variables. These are statically initialized, and should not be 
reset every time a function is entered.

I decided the patch in the PR was making the change in the wrong place. We've 
had problems before where it has been incorrectly assumed that certain 
variables are not marked for deferred intialization. Better to ignore them 
even if they are marked.

Tested on i686-linux.
Applied to mainline.

Paul

2004-10-07  Paul Brook  <paul@codesourcery.com>

 PR fortran/17678
 * trans-array.c (gfc_trans_deferred_array): Leave use associated
 variables alone.
testsuite/
 * gfortran.dg/use_allocated_1.f90: New test.

Index: trans-array.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/fortran/trans-array.c,v
retrieving revision 1.28
diff -u -p -r1.28 trans-array.c
--- trans-array.c 4 Oct 2004 13:03:37 -0000 1.28
+++ trans-array.c 7 Oct 2004 00:29:32 -0000
@@ -3999,8 +3999,8 @@ gfc_trans_deferred_array (gfc_symbol * s
       && !INTEGER_CST_P (sym->ts.cl->backend_decl))
     gfc_trans_init_string_length (sym->ts.cl, &fnblock);
 
-  /* Parameter variables don't need anything special.  */
-  if (sym->attr.dummy)
+  /* Parameter and use associated variables don't need anything special.  */
+  if (sym->attr.dummy || sym->attr.use_assoc)
     {
       gfc_add_expr_to_block (&fnblock, body);
 

Attachment: use_allocated_1.f90
Description: Text document


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