OSDN Git Service

* gcc-interface/utils.c (update_pointer_to): Clear TYPE_POINTER_TO and
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Oct 2010 17:44:05 +0000 (17:44 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Oct 2010 17:44:05 +0000 (17:44 +0000)
TYPE_REFERENCE_TO of the old type after redirecting its pointer and
reference types.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165926 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/pointer_discr1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/pointer_discr1_pkg1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/pointer_discr1_pkg2.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/pointer_discr1_pkg3.ads [new file with mode: 0644]

index 4ae15c6..b5162f7 100644 (file)
@@ -1,5 +1,11 @@
 2010-10-25  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gcc-interface/utils.c (update_pointer_to): Clear TYPE_POINTER_TO and
+       TYPE_REFERENCE_TO of the old type after redirecting its pointer and
+       reference types.
+
+2010-10-25  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Do not set
        TREE_THIS_NOTRAP on the INDIRECT_REF node built for the template.
 
index b70c6b7..1a5081d 100644 (file)
@@ -3427,6 +3427,7 @@ update_pointer_to (tree old_type, tree new_type)
       for (; ptr; ptr = TYPE_NEXT_PTR_TO (ptr))
        for (t = TYPE_MAIN_VARIANT (ptr); t; t = TYPE_NEXT_VARIANT (t))
          TREE_TYPE (t) = new_type;
+      TYPE_POINTER_TO (old_type) = NULL_TREE;
 
       /* Chain REF and its variants at the end.  */
       new_ref = TYPE_REFERENCE_TO (new_type);
@@ -3443,6 +3444,7 @@ update_pointer_to (tree old_type, tree new_type)
       for (; ref; ref = TYPE_NEXT_REF_TO (ref))
        for (t = TYPE_MAIN_VARIANT (ref); t; t = TYPE_NEXT_VARIANT (t))
          TREE_TYPE (t) = new_type;
+      TYPE_REFERENCE_TO (old_type) = NULL_TREE;
     }
 
   /* Now deal with the unconstrained array case.  In this case the pointer
index 9255d05..da3c046 100644 (file)
@@ -1,5 +1,12 @@
 2010-10-25  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gnat.dg/pointer_discr1.adb: New test.
+       * gnat.dg/pointer_discr1_pkg1.ads: New helper.
+       * gnat.dg/pointer_discr1_pkg2.ads: Likewise.
+       * gnat.dg/pointer_discr1_pkg3.ads: Likewise.
+
+2010-10-25  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gnat.dg/loop_optimization8.adb: New test.
        * gnat.dg/loop_optimization8_pkg1.ad[sb]: New helper.
        * gnat.dg/loop_optimization8_pkg2.ad[sb]: Likewise.
diff --git a/gcc/testsuite/gnat.dg/pointer_discr1.adb b/gcc/testsuite/gnat.dg/pointer_discr1.adb
new file mode 100644 (file)
index 0000000..e3c171e
--- /dev/null
@@ -0,0 +1,9 @@
+-- { dg-do compile }
+
+with Pointer_Discr1_Pkg1;
+with Pointer_Discr1_Pkg3;
+
+procedure Pointer_Discr1 is
+begin
+  Pointer_Discr1_Pkg3.Map(Pointer_Discr1_Pkg1.Window(1));
+end;
diff --git a/gcc/testsuite/gnat.dg/pointer_discr1_pkg1.ads b/gcc/testsuite/gnat.dg/pointer_discr1_pkg1.ads
new file mode 100644 (file)
index 0000000..a930af2
--- /dev/null
@@ -0,0 +1,9 @@
+with Pointer_Discr1_Pkg2;
+
+package Pointer_Discr1_Pkg1 is
+
+  type Arr is array (1..4) of Pointer_Discr1_Pkg2.T_WINDOW;
+
+  Window : Arr;
+
+end Pointer_Discr1_Pkg1;
diff --git a/gcc/testsuite/gnat.dg/pointer_discr1_pkg2.ads b/gcc/testsuite/gnat.dg/pointer_discr1_pkg2.ads
new file mode 100644 (file)
index 0000000..c510690
--- /dev/null
@@ -0,0 +1,10 @@
+with Unchecked_Conversion;
+with Pointer_Discr1_Pkg3;
+
+package Pointer_Discr1_Pkg2 is
+
+  subtype T_WINDOW is Pointer_Discr1_Pkg3.T_WINDOW(Pointer_Discr1_Pkg3.One);
+
+  function TO_WINDOW is new Unchecked_Conversion(Integer, T_WINDOW);
+
+end Pointer_Discr1_Pkg2;
diff --git a/gcc/testsuite/gnat.dg/pointer_discr1_pkg3.ads b/gcc/testsuite/gnat.dg/pointer_discr1_pkg3.ads
new file mode 100644 (file)
index 0000000..b27b514
--- /dev/null
@@ -0,0 +1,13 @@
+package Pointer_Discr1_Pkg3 is
+
+  type T_TYPE is (One, Two, Three);
+
+  type T_DATA (D : T_TYPE);
+
+  type T_DATA (D : T_TYPE) is null record;
+
+  type T_WINDOW is access T_DATA;
+
+  procedure Map (Window : in T_WINDOW);
+
+end Pointer_Discr1_Pkg3;