decl.c (gnat_to_gnu_entity): When processing the parent type...

* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: When
	processing the parent type, build the COMPONENT_REF for a discriminant
	with the proper type.

From-SVN: r153528
This commit is contained in:
Eric Botcazou 2009-10-24 11:12:21 +00:00 committed by Eric Botcazou
parent 2f18d9afae
commit e99c3ccc40
4 changed files with 32 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: When
processing the parent type, build the COMPONENT_REF for a discriminant
with the proper type.
2009-10-24 Eric Botcazou <ebotcazou@adacore.com> 2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* init.c (__gnat_adjust_context_for_raise): Mention _Unwind_GetIPInfo. * init.c (__gnat_adjust_context_for_raise): Mention _Unwind_GetIPInfo.

View File

@ -2729,15 +2729,16 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
Present (gnat_field); Present (gnat_field);
gnat_field = Next_Stored_Discriminant (gnat_field)) gnat_field = Next_Stored_Discriminant (gnat_field))
if (Present (Corresponding_Discriminant (gnat_field))) if (Present (Corresponding_Discriminant (gnat_field)))
save_gnu_tree {
(gnat_field, tree gnu_field
build3 (COMPONENT_REF, = gnat_to_gnu_field_decl (Corresponding_Discriminant
get_unpadded_type (Etype (gnat_field)), (gnat_field));
gnu_get_parent, save_gnu_tree
gnat_to_gnu_field_decl (Corresponding_Discriminant (gnat_field,
(gnat_field)), build3 (COMPONENT_REF, TREE_TYPE (gnu_field),
NULL_TREE), gnu_get_parent, gnu_field, NULL_TREE),
true); true);
}
/* Then we build the parent subtype. If it has discriminants but /* Then we build the parent subtype. If it has discriminants but
the type itself has unknown discriminants, this means that it the type itself has unknown discriminants, this means that it

View File

@ -1,3 +1,7 @@
2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/pack4.ads: New test.
2009-10-24 Eric Botcazou <ebotcazou@adacore.com> 2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/null_pointer_deref1.adb: New test. * gnat.dg/null_pointer_deref1.adb: New test.

View File

@ -0,0 +1,12 @@
package Pack4 is
type Buffer is array (Natural range <>) of Boolean;
type Root (Size : Natural) is tagged record
Data : Buffer (1..Size);
end record;
pragma Pack (Root);
type Derived is new Root with null record;
end Pack4;