diff options
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r-- | gcc/ada/freeze.adb | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 54b6202..be2115a 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -715,10 +715,11 @@ package body Freeze is then declare O_Ent : Entity_Id; + O_Typ : Entity_Id; Off : Boolean; begin - Find_Overlaid_Entity (Addr, O_Ent, Off); + Find_Overlaid_Entity (Addr, O_Ent, O_Typ, Off); if Ekind (O_Ent) = E_Constant and then Etype (O_Ent) = Typ @@ -1495,12 +1496,13 @@ package body Freeze is New_Formal := Defining_Identifier (New_F_Spec); -- If the controlling argument is inherited, add conversion to - -- parent type for the call. + -- parent type for the call. We make this an unchecked conversion + -- since the formal subtypes of the parent and derived subprograms + -- must conform, so checks should not be needed. if Is_Controlling_Formal (Formal) then Append_To (Actuals, - Make_Type_Conversion (Loc, - New_Occurrence_Of (Etype (Formal), Loc), + Unchecked_Convert_To (Etype (Formal), New_Occurrence_Of (New_Formal, Loc))); else Append_To (Actuals, New_Occurrence_Of (New_Formal, Loc)); @@ -5449,9 +5451,12 @@ package body Freeze is Set_Must_Be_On_Byte_Boundary (Rec); -- Check for component clause that is inconsistent with - -- the required byte boundary alignment. + -- the required byte boundary alignment. Do not do this + -- in CodePeer_Mode, as we do not have sufficient info + -- on size and representation clauses. - if Present (CC) + if not CodePeer_Mode + and then Present (CC) and then Normalized_First_Bit (Comp) mod System_Storage_Unit /= 0 then @@ -6869,9 +6874,10 @@ package body Freeze is end if; end if; - -- Static objects require special handling + -- Statically allocated objects require special handling if (Ekind (E) = E_Constant or else Ekind (E) = E_Variable) + and then No (Renamed_Object (E)) and then Is_Statically_Allocated (E) then Freeze_Static_Object (E); @@ -9389,16 +9395,17 @@ package body Freeze is -- pre/postconditions during expansion of the subprogram body, the -- subprogram is already installed. - -- Call Preanalyze_Spec_Expression instead of Preanalyze_And_Resolve - -- for the sake of consistency with Analyze_Expression_Function. + -- Call Preanalyze_And_Resolve_Spec_Expression instead of Preanalyze_ + -- And_Resolve for the sake of consistency with Analyze_Expression_ + -- Function. if Def_Id /= Current_Scope then Push_Scope (Def_Id); Install_Formals (Def_Id); - Preanalyze_Spec_Expression (Dup_Expr, Typ); + Preanalyze_And_Resolve_Spec_Expression (Dup_Expr, Typ); End_Scope; else - Preanalyze_Spec_Expression (Dup_Expr, Typ); + Preanalyze_And_Resolve_Spec_Expression (Dup_Expr, Typ); end if; -- Restore certain attributes of Def_Id since the preanalysis may @@ -10230,11 +10237,17 @@ package body Freeze is -- issue an error message saying that this object cannot be imported -- or exported. If it has an address clause it is an overlay in the -- current partition and the static requirement is not relevant. - -- Do not issue any error message when ignoring rep clauses. + -- Do not issue any error message when ignoring rep clauses or for + -- compiler-generated entities. if Ignore_Rep_Clauses then null; + elsif not Comes_From_Source (E) then + pragma + Assert (Nkind (Parent (Declaration_Node (E))) in N_Case_Statement + | N_If_Statement); + elsif Is_Imported (E) then if No (Address_Clause (E)) then Error_Msg_N |