Commit 51c7954d by Eric Botcazou Committed by Eric Botcazou

decl.c (gnat_to_gnu_entity): Create TYPE_DECL for the padded type built to…

decl.c (gnat_to_gnu_entity): Create TYPE_DECL for the padded type built to support a specified size or alignment.

	* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Create TYPE_DECL
	for the padded type built to support a specified size or alignment.

From-SVN: r171554
parent 6ddf9843
2011-03-26 Eric Botcazou <ebotcazou@adacore.com> 2011-03-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Create TYPE_DECL
for the padded type built to support a specified size or alignment.
2011-03-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/gigi.h (finalize_from_with_types): Adjust comment. * gcc-interface/gigi.h (finalize_from_with_types): Adjust comment.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Type>: Defer * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Access_Type>: Defer
unconditionally to the end of the unit when the designated type is unconditionally to the end of the unit when the designated type is
......
...@@ -911,10 +911,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -911,10 +911,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
size of the object. */ size of the object. */
gnu_object_size = gnu_size ? gnu_size : TYPE_SIZE (gnu_type); gnu_object_size = gnu_size ? gnu_size : TYPE_SIZE (gnu_type);
if (gnu_size || align > 0) if (gnu_size || align > 0)
{
tree orig_type = gnu_type;
gnu_type = maybe_pad_type (gnu_type, gnu_size, align, gnat_entity, gnu_type = maybe_pad_type (gnu_type, gnu_size, align, gnat_entity,
false, false, definition, false, false, definition,
gnu_size ? true : false); gnu_size ? true : false);
/* If a padding record was made, declare it now since it will
never be declared otherwise. This is necessary to ensure
that its subtrees are properly marked. */
if (gnu_type != orig_type && !DECL_P (TYPE_NAME (gnu_type)))
create_type_decl (TYPE_NAME (gnu_type), gnu_type, NULL, true,
debug_info_p, gnat_entity);
}
/* If this is a renaming, avoid as much as possible to create a new /* If this is a renaming, avoid as much as possible to create a new
object. However, in several cases, creating it is required. object. However, in several cases, creating it is required.
This processing needs to be applied to the raw expression so This processing needs to be applied to the raw expression so
......
2011-03-26 Eric Botcazou <ebotcazou@adacore.com> 2011-03-26 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/discr27.ad[sb]: New test.
2011-03-26 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/limited_with2.ad[sb]: New test. * gnat.dg/limited_with2.ad[sb]: New test.
* gnat.dg/limited_with2_pkg1.ads: New helper. * gnat.dg/limited_with2_pkg1.ads: New helper.
* gnat.dg/imited_with2_pkg2.ads: Likewise. * gnat.dg/imited_with2_pkg2.ads: Likewise.
......
package body Discr27 is
subtype Index is Positive range 1..4096;
function F return String is
S : String(1..1) := (others =>'w');
begin
return S;
end;
type Enum is (One, Two);
type Rec (D : Enum := One; Len : Index := 1) is record
case D is
when One => I : Integer;
when Two => A : String(1..Len);
end case;
end record;
procedure Nothing is
M : constant String := F;
C : constant Rec := (Two, M'Length, M);
begin
null;
end;
procedure Proc is begin
null;
end;
end Discr27;
-- { dg-do compile }
package Discr27 is
procedure Proc;
end Discr27;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment