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]

[PATCH] Improve VLAs in Fortran debuginfo even at -O1+


Hi!

This is something I've changed in gimplify.c for PR43150, but forgot
that Fortran FE has similar stuff.

Even for -O1 and above clearing DECL_IGNORED_P makes sense, as the variable
can be then tracked by VTA and thus the debugger can get a location
expression or location list for the size.

One tiny issue left is (but that is for -O0 -g too) is that these
artificial vars still have names like ubound.0 and those names show up in
the debug info (the DIEs are DW_AT_artificial, but still).  I guess it would
make code less readable in the FE if we switched to some other names
(__ prefixed or starting with . or something similar); one possibility is
clear DECL_NAME of these vars when handing them over to middle-end (e.g.
through a gimplify_expr langhook).  It isn't a big deal, just that
when e.g. looking for current variables starting with u you enter u and tab
in the debugger and it will offer ubound.0 completion among other things.

Ok for trunk?

2010-04-14  Jakub Jelinek  <jakub@redhat.com>

	* trans-decl.c (gfc_build_qualified_array): Clear DECL_IGNORED_P
	on VAR_DECL LBOUND and/or UBOUND, even for -O1.

--- gcc/fortran/trans-decl.c.jj	2010-04-13 14:16:39.000000000 +0200
+++ gcc/fortran/trans-decl.c	2010-04-14 19:40:49.000000000 +0200
@@ -775,16 +775,15 @@ gfc_build_qualified_array (tree decl, gf
 				    GFC_TYPE_ARRAY_LBOUND (type, dim),
 				    GFC_TYPE_ARRAY_UBOUND (type, dim));
 	  gtype = build_array_type (gtype, rtype);
-	  /* Ensure the bound variables aren't optimized out at -O0.  */
-	  if (!optimize)
-	    {
-	      if (GFC_TYPE_ARRAY_LBOUND (type, dim)
-		  && TREE_CODE (GFC_TYPE_ARRAY_LBOUND (type, dim)) == VAR_DECL)
-		DECL_IGNORED_P (GFC_TYPE_ARRAY_LBOUND (type, dim)) = 0;
-	      if (GFC_TYPE_ARRAY_UBOUND (type, dim)
-		  && TREE_CODE (GFC_TYPE_ARRAY_UBOUND (type, dim)) == VAR_DECL)
-		DECL_IGNORED_P (GFC_TYPE_ARRAY_UBOUND (type, dim)) = 0;
-	    }
+	  /* Ensure the bound variables aren't optimized out at -O0.
+	     For -O1 and above they often will be optimized out, but
+	     can be tracked by VTA.  */
+	  if (GFC_TYPE_ARRAY_LBOUND (type, dim)
+	      && TREE_CODE (GFC_TYPE_ARRAY_LBOUND (type, dim)) == VAR_DECL)
+	    DECL_IGNORED_P (GFC_TYPE_ARRAY_LBOUND (type, dim)) = 0;
+	  if (GFC_TYPE_ARRAY_UBOUND (type, dim)
+	      && TREE_CODE (GFC_TYPE_ARRAY_UBOUND (type, dim)) == VAR_DECL)
+	    DECL_IGNORED_P (GFC_TYPE_ARRAY_UBOUND (type, dim)) = 0;
 	}
       TYPE_NAME (type) = type_decl = build_decl (input_location,
 						 TYPE_DECL, NULL, gtype);

	Jakub


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