public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix slightly invalid debug info
@ 2011-01-04  9:56 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2011-01-04  9:56 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

This fixes a regression present on the mainline and 4.5 branch, which results 
in slightly invalid DWARF debug info (some consumers issue a warning for it): 
OUT parameters for procedures may appear within a lexical block instead of at 
the outermost level.

Tested on i586-suse-linux, applied on the mainline and 4.5 branch.


2011-01-04  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (Subprogram_Body_to_gnu): Evaluate the
	expressions of the parameter cache within the statement group of
	the CICO mechanism.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 2301 bytes --]

Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 168455)
+++ gcc-interface/trans.c	(working copy)
@@ -2603,6 +2603,31 @@ Subprogram_Body_to_gnu (Node_Id gnat_nod
   gnat_poplevel ();
   gnu_result = end_stmt_group ();
 
+  /* If we populated the parameter attributes cache, we need to make sure that
+     the cached expressions are evaluated on all the possible paths leading to
+     their uses.  So we force their evaluation on entry of the function.  */
+  cache = DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language->parm_attr_cache;
+  if (cache)
+    {
+      struct parm_attr_d *pa;
+      int i;
+
+      start_stmt_group ();
+
+      FOR_EACH_VEC_ELT (parm_attr, cache, i, pa)
+	{
+	  if (pa->first)
+	    add_stmt_with_node_force (pa->first, gnat_node);
+	  if (pa->last)
+	    add_stmt_with_node_force (pa->last, gnat_node);
+	  if (pa->length)
+	    add_stmt_with_node_force (pa->length, gnat_node);
+	}
+
+      add_stmt (gnu_result);
+      gnu_result = end_stmt_group ();
+    }
+
   /* If we are dealing with a return from an Ada procedure with parameters
      passed by copy-in/copy-out, we need to return a record containing the
      final values of these parameters.  If the list contains only one entry,
@@ -2637,31 +2662,6 @@ Subprogram_Body_to_gnu (Node_Id gnat_nod
 
   VEC_pop (tree, gnu_return_label_stack);
 
-  /* If we populated the parameter attributes cache, we need to make sure that
-     the cached expressions are evaluated on all the possible paths leading to
-     their uses.  So we force their evaluation on entry of the function.  */
-  cache = DECL_STRUCT_FUNCTION (gnu_subprog_decl)->language->parm_attr_cache;
-  if (cache)
-    {
-      struct parm_attr_d *pa;
-      int i;
-
-      start_stmt_group ();
-
-      FOR_EACH_VEC_ELT (parm_attr, cache, i, pa)
-	{
-	  if (pa->first)
-	    add_stmt_with_node_force (pa->first, gnat_node);
-	  if (pa->last)
-	    add_stmt_with_node_force (pa->last, gnat_node);
-	  if (pa->length)
-	    add_stmt_with_node_force (pa->length, gnat_node);
-	}
-
-      add_stmt (gnu_result);
-      gnu_result = end_stmt_group ();
-    }
-
   end_subprog_body (gnu_result);
 
   /* Attempt setting the end_locus of our GCC body tree, typically a

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-04  9:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-04  9:56 [Ada] Fix slightly invalid debug info Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).