utils.c (gnat_pushdecl): If this is a non-artificial declaration of a pointer type...
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 2 Apr 2011 08:59:45 +0000 (08:59 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 2 Apr 2011 08:59:45 +0000 (08:59 +0000)
* gcc-interface/utils.c (gnat_pushdecl): If this is a non-artificial
declaration of a pointer type, then set DECL_ORIGINAL_TYPE to a
distinct copy.

From-SVN: r171885

gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c

index ef21acc3380d5e86267a09ee8bacd5284147e228..766d2bcfdb56723357b98689179f625eff12d4b3 100644 (file)
@@ -1,3 +1,9 @@
+2011-04-02  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/utils.c (gnat_pushdecl): If this is a non-artificial
+       declaration of a pointer type, then set DECL_ORIGINAL_TYPE to a
+       distinct copy.
+
 2011-04-02  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/decl.c (gnat_to_gnu_entity): Do not force the
index 6472a0cda177da002d284ddde62b0ff1a0924207..bd6badd5929c6fbe40cd18c91d04cab76e5df6d7 100644 (file)
@@ -560,12 +560,16 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
 
       if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL))
        {
-         /* Array types aren't tagged types in the C sense so we force the
+         /* Array and pointer types aren't "tagged" types so we force the
             type to be associated with its typedef in the DWARF back-end,
             in order to make sure that the latter is always preserved.  */
-         if (!DECL_ARTIFICIAL (decl) && TREE_CODE (t) == ARRAY_TYPE)
+         if (!DECL_ARTIFICIAL (decl)
+             && (TREE_CODE (t) == ARRAY_TYPE
+                 || TREE_CODE (t) == POINTER_TYPE))
            {
              tree tt = build_distinct_type_copy (t);
+             if (TREE_CODE (t) == POINTER_TYPE)
+               TYPE_NEXT_PTR_TO (t) = tt;
              TYPE_NAME (tt) = DECL_NAME (decl);
              TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t);
              DECL_ORIGINAL_TYPE (decl) = tt;