[gfortran] Minor fix for parse tree dumper

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Tue May 11 15:17:00 GMT 2004


For an array subscript of the form a((/1,2,3/)) the tree dumper used to 
print a( (/ 1, 2, 3/):), where the colon is obviously unnecessary and 
confusing. This patch fixes that.

- Tobi

2004-05-11  Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>

	* dump-parse-tree.c (gfc_show_array_ref): Print colon only
	for ranges when dumping array references.


Index: dump-parse-tree.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/Attic/dump-parse-tree.c,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 dump-parse-tree.c
--- dump-parse-tree.c	1 Jan 2004 12:09:12 -0000	1.1.2.3
+++ dump-parse-tree.c	11 May 2004 15:02:00 -0000
@@ -186,15 +186,21 @@ gfc_show_array_ref (gfc_array_ref * ar)
  	  if (ar->start[i] != NULL)
  	    gfc_show_expr (ar->start[i]);

-	  gfc_status_char (':');
+	  /* there are two types of array sections: either an integer
+	     array ('vector'), or a range.  */

-	  if (ar->end[i] != NULL)
-	    gfc_show_expr (ar->end[i]);
-
-	  if (ar->stride[i] != NULL)
+	  if (ar->dimen_type[i] == DIMEN_RANGE)
  	    {
  	      gfc_status_char (':');
-	      gfc_show_expr (ar->stride[i]);
+	
+	      if (ar->end[i] != NULL)
+		gfc_show_expr (ar->end[i]);
+	
+	      if (ar->stride[i] != NULL)
+		{
+		  gfc_status_char (':');
+		  gfc_show_expr (ar->stride[i]);
+		}
  	    }

  	  if (i != ar->dimen - 1)



More information about the Fortran mailing list