utils.c (update_pointer_to): Clear TYPE_POINTER_TO and TYPE_REFERENCE_TO of the old type after redirecting...
* 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. From-SVN: r165926
This commit is contained in:
parent
8c211c83bb
commit
3bd6ca3f11
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,10 @@
|
||||
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.
|
||||
|
9
gcc/testsuite/gnat.dg/pointer_discr1.adb
Normal file
9
gcc/testsuite/gnat.dg/pointer_discr1.adb
Normal file
@ -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;
|
9
gcc/testsuite/gnat.dg/pointer_discr1_pkg1.ads
Normal file
9
gcc/testsuite/gnat.dg/pointer_discr1_pkg1.ads
Normal file
@ -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;
|
10
gcc/testsuite/gnat.dg/pointer_discr1_pkg2.ads
Normal file
10
gcc/testsuite/gnat.dg/pointer_discr1_pkg2.ads
Normal file
@ -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;
|
13
gcc/testsuite/gnat.dg/pointer_discr1_pkg3.ads
Normal file
13
gcc/testsuite/gnat.dg/pointer_discr1_pkg3.ads
Normal file
@ -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;
|
Loading…
Reference in New Issue
Block a user