diff options
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r-- | gcc/ada/sem_res.adb | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index b73b947..e44994a 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -757,14 +757,6 @@ package body Sem_Res is goto No_Danger; end if; - -- If the enclosing type is limited, we allocate only the - -- default value, not the maximum, and there is no need for - -- a warning. - - if Is_Limited_Type (Scope (Disc)) then - goto No_Danger; - end if; - -- Check that it is the high bound if N /= High_Bound (PN) @@ -811,11 +803,9 @@ package body Sem_Res is goto No_Danger; end if; - -- Warn about the danger - - Error_Msg_N - ("??creation of & object may raise Storage_Error!", - Scope (Disc)); + if Ekind (Scope (Disc)) = E_Record_Type then + Set_Is_Large_Unconstrained_Definite (Scope (Disc)); + end if; <<No_Danger>> null; @@ -2106,8 +2096,6 @@ package body Sem_Res is Full_Analysis := False; Expander_Mode_Save_And_Set (False); - -- See also Preanalyze_And_Resolve in sem.adb for similar handling - -- Normally, we suppress all checks for this preanalysis. There is no -- point in processing them now, since they will be applied properly -- and in the proper location when the default expressions reanalyzed @@ -2150,8 +2138,13 @@ package body Sem_Res is Full_Analysis := False; Expander_Mode_Save_And_Set (False); - Analyze (N); - Resolve (N, Etype (N), Suppress => All_Checks); + -- See previous version of Preanalyze_And_Resolve for similar handling + + if GNATprove_Mode then + Analyze_And_Resolve (N); + else + Analyze_And_Resolve (N, Suppress => All_Checks); + end if; Expander_Mode_Restore; Full_Analysis := Save_Full_Analysis; @@ -4849,6 +4842,7 @@ package body Sem_Res is if not Is_OK_Variable_For_Out_Formal (A) and then not Is_Init_Proc (Nam) + and then not Is_Expanded_Constructor_Call (N) then Error_Msg_NE ("actual for& must be a variable", A, F); @@ -6101,6 +6095,8 @@ package body Sem_Res is elsif Is_Fixed_Point_Type (It.Typ) then if Analyzed (N) then Error_Msg_N ("ambiguous operand in fixed operation", N); + elsif It.Typ = Any_Fixed then + Resolve (N, B_Typ); else Resolve (N, It.Typ); end if; @@ -7801,6 +7797,7 @@ package body Sem_Res is then Set_Entity (N, Local); Set_Etype (N, Etype (Local)); + Generate_Reference (Local, N); end if; return OK; @@ -8150,6 +8147,7 @@ package body Sem_Res is and then not Preanalysis_Active and then not Is_Imported (E) and then Nkind (Parent (E)) /= N_Object_Renaming_Declaration + and then not Needs_Construction (Etype (E)) then if No_Initialization (Parent (E)) or else (Present (Full_View (E)) @@ -12465,16 +12463,6 @@ package body Sem_Res is Orig_N := Original_Node (Expression (Orig_N)); Orig_T := Target_Typ; - -- If the node is part of a larger expression, the Target_Type - -- may not be the original type of the node if the context is a - -- condition. Recover original type to see if conversion is needed. - - if Is_Boolean_Type (Orig_T) - and then Nkind (Parent (N)) in N_Op - then - Orig_T := Etype (Parent (N)); - end if; - -- If we have an entity name, then give the warning if the entity -- is the right type, or if it is a loop parameter covered by the -- original type (that's needed because loop parameters have an @@ -12550,6 +12538,16 @@ package body Sem_Res is then null; + -- Do not warn if original source-level conversion was + -- between two different types. + + elsif Nkind (Original_Node (N)) = N_Type_Conversion + and then + Base_Type (Etype (Subtype_Mark (Original_Node (N)))) + /= Base_Type (Etype (Expression (Original_Node (N)))) + then + null; + -- Here we give the redundant conversion warning. If it is an -- entity, give the name of the entity in the message. If not, -- just mention the expression. |