[gfortran,patch] Fix comments

Erik Edelmann eedelman@acclab.helsinki.fi
Sat Aug 27 11:31:00 GMT 2005


While browsing through some gfortran code, I found two comments
in trans-array.c/gfc_trans_deferred_array() that didn't make much
sense to me (but it's of course possible that I've only
missunderstood something).

The first one is the comment that introduces the function.  It
says

/* NULLIFY an allocated/pointer array on function entry, free it on exit.  */

I don't see why we would want to nullify an allocatED array, and
from the code I conclude that it is allocatABLE arrays we are
dealing with.

The other comment I found confusing was

/* Parameter and use associated variables don't need anything special.  */
if (sym->attr.dummy || sym->attr.use_assoc)
  {
  ...
  }

The if statement clearly checks for dummy variables, not
parameters (allocatable/pointer arrays can't be parameters
anyway).

Patch to fix these attached, please commit if OK.  (I did not
regression test it because testing comments-only changes seems a
bit overkill to me, but I can of course run the testsuite if
anyone thinks it's needed).


2005-08-26  Erik Edelmann  <erik.edelmann@iki.fi>

        * trans-array.c (gfc_trans_deferred_array): Fix comments.



        Erik
-------------- next part --------------
Index: gcc/fortran/trans-array.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/trans-array.c,v
retrieving revision 1.54
diff -u -p -r1.54 trans-array.c
--- gcc/fortran/trans-array.c	6 Aug 2005 12:56:18 -0000	1.54
+++ gcc/fortran/trans-array.c	26 Aug 2005 20:40:05 -0000
@@ -3982,7 +3982,7 @@ gfc_conv_array_parameter (gfc_se * se, g
 }
 
 
-/* NULLIFY an allocated/pointer array on function entry, free it on exit.  */
+/* NULLIFY an allocatable/pointer array on function entry, free it on exit.  */
 
 tree
 gfc_trans_deferred_array (gfc_symbol * sym, tree body)
@@ -4007,7 +4007,7 @@ 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 and use associated variables don't need anything special.  */
+  /* Dummy and use associated variables don't need anything special.  */
   if (sym->attr.dummy || sym->attr.use_assoc)
     {
       gfc_add_expr_to_block (&fnblock, body);


More information about the Fortran mailing list