diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-12-12 12:54:30 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-12-12 12:54:30 +0100 |
commit | 6bed26b5427ac521b5b1bea8d4f24f265980670d (patch) | |
tree | e566c00a722d5b074112e751aaa53d7d1d10dfdd /gcc/ada/exp_util.adb | |
parent | fe58fea70b2614f36fb9e1fde78af892426ad8a6 (diff) | |
download | gcc-6bed26b5427ac521b5b1bea8d4f24f265980670d.zip gcc-6bed26b5427ac521b5b1bea8d4f24f265980670d.tar.gz gcc-6bed26b5427ac521b5b1bea8d4f24f265980670d.tar.bz2 |
[multiple changes]
2011-12-12 Robert Dewar <dewar@adacore.com>
* sem_prag.adb (GNAT_Pragma): Check comes from source.
2011-12-12 Robert Dewar <dewar@adacore.com>
* gnatls.adb: Minor reformatting.
2011-12-12 Javier Miranda <miranda@adacore.com>
* a-tags.ads (Alignment): New TSD field.
(Max_Predef_Prims): Value lowered to 15 (or 9 in case of
configurable runtime) Update documentation of predefined
primitives since Alignment has been removed.
* exp_disp.ads Update documentation of slots of dispatching
primitives.
* exp_disp.adb (Default_Prim_Op_Position): Update slot
values since alignment is no longer a predefined primitive.
(Is_Predefined_Dispatch_Operation): Remove _alignment.
(Is_Predefined_Internal_Operation): Remove _alignment.
(Make_DT): Update static test on the value stored in a-tags.ads
for Max_Predef_Prims; store the value of 'alignment in the TSD.
* exp_atag.ads, exp_atag.adb (Build_Get_Alignment): New subprogram
that retrieves the alignment from the TSD
* exp_util.adb (Build_Allocated_Deallocate_Proc): For deallocation
of class-wide types obtain the value of alignment from the TSD.
* exp_attr.adb (Expand_N_Attribute_Reference): For 'alignment
applied to a class-wide type invoke Build_Get_Alignment to
generate code which retrieves the value of the alignment from
the TSD.
* rtsfind.ads (RE_Alignment): New Ada.Tags entity
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): For tagged
types if the value of the alignment is bigger than the Maximum
alignment then set the value of the alignment to the Maximum
alignment and report a warning.
* exp_ch3.adb (Make_Predefined_Primitive_Specs): Do not generate
spec of _alignment.
(Predefined_Primitive_Bodies): Do not generate body of _alignment.
From-SVN: r182229
Diffstat (limited to 'gcc/ada/exp_util.adb')
-rw-r--r-- | gcc/ada/exp_util.adb | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index c67d011..3dd99e9 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -755,7 +755,32 @@ package body Exp_Util is Append_To (Actuals, New_Reference_To (Addr_Id, Loc)); Append_To (Actuals, New_Reference_To (Size_Id, Loc)); - Append_To (Actuals, New_Reference_To (Alig_Id, Loc)); + + if Is_Allocate + or else not Is_Class_Wide_Type (Desig_Typ) + then + Append_To (Actuals, New_Reference_To (Alig_Id, Loc)); + + -- For deallocation of class wide types we obtain the value of + -- alignment from the Type Specific Record of the deallocated object. + -- This is needed because the frontend expansion of class-wide types + -- into equivalent types confuses the backend. + + else + -- Generate: + -- Obj.all'Alignment + + -- ... because 'Alignment applied to class-wide types is expanded + -- into the code that reads the value of alignment from the TSD + -- (see Expand_N_Attribute_Reference) + + Append_To (Actuals, + Unchecked_Convert_To (RTE (RE_Storage_Offset), + Make_Attribute_Reference (Loc, + Prefix => + Make_Explicit_Dereference (Loc, Relocate_Node (Expr)), + Attribute_Name => Name_Alignment))); + end if; -- h) Is_Controlled |