diff options
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/pointer_discr1.adb | 9 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/pointer_discr1_pkg1.ads | 9 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/pointer_discr1_pkg2.ads | 10 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/pointer_discr1_pkg3.ads | 13 |
7 files changed, 56 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4ae15c6..b5162f7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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. diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index b70c6b7..1a5081d 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9255d05..da3c046 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 0000000..e3c171e --- /dev/null +++ b/gcc/testsuite/gnat.dg/pointer_discr1.adb @@ -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 index 0000000..a930af2 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pointer_discr1_pkg1.ads @@ -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 index 0000000..c510690 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pointer_discr1_pkg2.ads @@ -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 index 0000000..b27b514 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pointer_discr1_pkg3.ads @@ -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; |