decl.c (gnat_to_gnu_entity): Deal with variable built for a debug renaming declaratio...
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 10 Sep 2007 08:52:53 +0000 (08:52 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 10 Sep 2007 08:52:53 +0000 (08:52 +0000)
* decl.c (gnat_to_gnu_entity) <object>: Deal with variable built for
a debug renaming declaration specially.

From-SVN: r128327

gcc/ada/ChangeLog
gcc/ada/decl.c

index 3c5969d96ea3e9f95b63cfb50644988618a47e1a..b4824a9d5ce601bdf1d2f9104d84bbebdabaa682 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-10  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * decl.c (gnat_to_gnu_entity) <object>: Deal with variable built for
+       a debug renaming declaration specially.
+
 2007-09-08  Eric Botcazou  <ebotcazou@adacore.com>
 
        * decl.c (gnat_to_gnu_entity) <Object>: Simplify the condition under
index 202cca851ad3d2b13f8e9b5115086448b93b4e59..5aa4bc8dd3708754f9536ad1d2b56a5b35d29a63 100644 (file)
@@ -523,6 +523,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
        /* Get the type after elaborating the renamed object.  */
        gnu_type = gnat_to_gnu_type (Etype (gnat_entity));
 
+       /* For a debug renaming declaration, build a pure debug entity.  */
+       if (Present (Debug_Renaming_Link (gnat_entity)))
+         {
+           rtx addr;
+           gnu_decl = build_decl (VAR_DECL, gnu_entity_id, gnu_type);
+           /* The (MEM (CONST (0))) pattern is prescribed by STABS.  */
+           if (global_bindings_p ())
+             addr = gen_rtx_CONST (VOIDmode, const0_rtx);
+           else
+             addr = stack_pointer_rtx;
+           SET_DECL_RTL (gnu_decl, gen_rtx_MEM (Pmode, addr));
+           gnat_pushdecl (gnu_decl, gnat_entity);
+           break;
+         }
+
        /* If this is a loop variable, its type should be the base type.
           This is because the code for processing a loop determines whether
           a normal loop end test can be done by comparing the bounds of the