From: Pierre-Marie de Rodat Date: Thu, 9 Nov 2017 11:33:12 +0000 (+0000) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dcd5fd67facffa75407125066f8db852f5ee580e;p=gcc.git [multiple changes] 2017-11-09 Yannick Moy * binde.adb (Diagnose_Elaboration_Problem): Mark procedure No_Return. * checks.adb (Apply_Scalar_Range_Check): Rescope variable OK closer to use. Default initialize Hi, Lo. (Selected_Range_Checks): Retype Num_Checks more precisely. (Determine_Range, Determine_Range_R): Default initialize Hi_Right, Lo_Right. * contracts.adb (Process_Contract_Cases): Mark parameter Stmts as Unmodified. (Process_Postconditions): Mark parameter Stmts as Unmodified. * exp_attr.adb (Expand_Loop_Entry_Attribute): Default initialize Blk. * exp_ch4.adb (Expand_N_Allocator): Default initialize Typ. (Expand_Concatenate): Default initialize High_Bound. (Optimize_Length_Comparison): Default initialize Ent, Index. * exp_ch5.adb (Expand_Predicated_Loop): Default initialize L_Hi and L_Lo. * exp_ch6.adb (Expand_N_Extended_Return_Statement): Default initialize Return_Stmt. * exp_ch9.adb (Expand_Entry_Barrier): Default initialize Func_Body and remove pragma Warnings(Off). * exp_imgv.adb (Expand_Image_Attribute): Default initialize Tent. * exp_util.adb (Find_Interface_Tag): Default initialize AI_Tag. * freeze.adb (Check_Component_Storage_Order): Default initialize Comp_Byte_Aligned rather than silencing messages with pragma Warnings(Off), which does not work for CodePeer initialization messages, and given that here the possible read of an unitialized value depends on a proper use of parameters by the caller. * inline.adb (Expand_Inlined_Call): Default initialize Lab_Decl, Targ. * sem_ch12.adb (Build_Operator_Wrapper): Default initialize Expr. * sem_ch3.adb (Build_Derived_Array_Type): Default initialize Implicit_Base. * sem_ch4.adb (List_Operand_Interps): Default initialize Nam and remove pragma Warnings(Off). (Analyze_Case_Expression): Rescope checking block within branch where Others_Present is set by the call to Check_Choices. * sem_ch5.adb (Analyze_Assignment): Default initialize Save_Full_Analysis. * sem_ch6.adb (Analyze_Function_Return): Default initialize Obj_Decl, and restructure code to defend against previous errors, so that, in that case, control does not flow to the elsif condition which read an uninitialized Obj_Decl. * sem_ch9.adb (Analyze_Requeue): Default initialize Synch_Type. (Check_Interfaces): Default initialize Full_T_Ifaces and Priv_T_Ifaces, which seem to be left uninitialized and possibly read in some cases. * sem_dim.adb (Analyze_Aspect_Dimension_System): Retype Position more precisely. This requires to exchange the test for exiting in case of too many positions and the increment to Position, inside the loop. * sem_eval.adb (Eval_Concatenation): Default initialize Folded_Val, which cannot be read uninitialized, but the reasons for that are quite subtle. * sem_intr.adb (Check_Intrinsic_Call): Default initialize Rtyp. * sem_prag.adb (Collect_Subprogram_Inputs_Outputs): Default initialize Spec_Id. * sem_res.adb (Make_Call_Into_Operator): Default initialize Opnd_Type, and test for presence of non-null Opnd_Type before testing its scope, in a test which would read its value uninitialized, and is very rarely exercized (it depends on the presence of an extension of System). * sem_spark.ads: Update comment to fix name of main analysis procedure. * sem_warn.adb (Warn_On_Known_Condition): Default initialize Test_Result. * set_targ.adb (FailN): Mark procedure with No_Return. * stylesw.adb (Save_Style_Check_Options): Delete useless code to initialize all array Options to white space, as there is already code doing the same for the remaining positions in Options at the end of the procedure. 2017-11-09 Eric Botcazou * exp_ch11.adb (Possible_Local_Raise): Do not issue the warning for generic instantiations either. From-SVN: r254570 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1e599d03aa2..f612544118a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,75 @@ +2017-11-09 Yannick Moy + + * binde.adb (Diagnose_Elaboration_Problem): Mark procedure No_Return. + * checks.adb (Apply_Scalar_Range_Check): Rescope variable OK closer to + use. Default initialize Hi, Lo. + (Selected_Range_Checks): Retype Num_Checks more precisely. + (Determine_Range, Determine_Range_R): Default initialize Hi_Right, + Lo_Right. + * contracts.adb (Process_Contract_Cases): Mark parameter Stmts as + Unmodified. + (Process_Postconditions): Mark parameter Stmts as Unmodified. + * exp_attr.adb (Expand_Loop_Entry_Attribute): Default initialize Blk. + * exp_ch4.adb (Expand_N_Allocator): Default initialize Typ. + (Expand_Concatenate): Default initialize High_Bound. + (Optimize_Length_Comparison): Default initialize Ent, Index. + * exp_ch5.adb (Expand_Predicated_Loop): Default initialize L_Hi and + L_Lo. + * exp_ch6.adb (Expand_N_Extended_Return_Statement): Default initialize + Return_Stmt. + * exp_ch9.adb (Expand_Entry_Barrier): Default initialize Func_Body and + remove pragma Warnings(Off). + * exp_imgv.adb (Expand_Image_Attribute): Default initialize Tent. + * exp_util.adb (Find_Interface_Tag): Default initialize AI_Tag. + * freeze.adb (Check_Component_Storage_Order): Default initialize + Comp_Byte_Aligned rather than silencing messages with pragma + Warnings(Off), which does not work for CodePeer initialization + messages, and given that here the possible read of an unitialized value + depends on a proper use of parameters by the caller. + * inline.adb (Expand_Inlined_Call): Default initialize Lab_Decl, Targ. + * sem_ch12.adb (Build_Operator_Wrapper): Default initialize Expr. + * sem_ch3.adb (Build_Derived_Array_Type): Default initialize + Implicit_Base. + * sem_ch4.adb (List_Operand_Interps): Default initialize Nam and remove + pragma Warnings(Off). + (Analyze_Case_Expression): Rescope checking block within branch where + Others_Present is set by the call to Check_Choices. + * sem_ch5.adb (Analyze_Assignment): Default initialize + Save_Full_Analysis. + * sem_ch6.adb (Analyze_Function_Return): Default initialize Obj_Decl, + and restructure code to defend against previous errors, so that, in + that case, control does not flow to the elsif condition which read an + uninitialized Obj_Decl. + * sem_ch9.adb (Analyze_Requeue): Default initialize Synch_Type. + (Check_Interfaces): Default initialize Full_T_Ifaces and Priv_T_Ifaces, + which seem to be left uninitialized and possibly read in some cases. + * sem_dim.adb (Analyze_Aspect_Dimension_System): Retype Position more + precisely. This requires to exchange the test for exiting in case of + too many positions and the increment to Position, inside the loop. + * sem_eval.adb (Eval_Concatenation): Default initialize Folded_Val, + which cannot be read uninitialized, but the reasons for that are quite + subtle. + * sem_intr.adb (Check_Intrinsic_Call): Default initialize Rtyp. + * sem_prag.adb (Collect_Subprogram_Inputs_Outputs): Default initialize + Spec_Id. + * sem_res.adb (Make_Call_Into_Operator): Default initialize Opnd_Type, + and test for presence of non-null Opnd_Type before testing its scope, + in a test which would read its value uninitialized, and is very rarely + exercized (it depends on the presence of an extension of System). + * sem_spark.ads: Update comment to fix name of main analysis procedure. + * sem_warn.adb (Warn_On_Known_Condition): Default initialize + Test_Result. + * set_targ.adb (FailN): Mark procedure with No_Return. + * stylesw.adb (Save_Style_Check_Options): Delete useless code to + initialize all array Options to white space, as there is already code + doing the same for the remaining positions in Options at the end of the + procedure. + +2017-11-09 Eric Botcazou + + * exp_ch11.adb (Possible_Local_Raise): Do not issue the warning for + generic instantiations either. + 2017-11-09 Piotr Trojanek * sem_prag.adb (Analyze_Part_Of): Reword error message. diff --git a/gcc/ada/binde.adb b/gcc/ada/binde.adb index dd076be3acf..5a78bc82499 100644 --- a/gcc/ada/binde.adb +++ b/gcc/ada/binde.adb @@ -353,6 +353,7 @@ package body Binde is procedure Diagnose_Elaboration_Problem (Elab_Order : in out Unit_Id_Table); + pragma No_Return (Diagnose_Elaboration_Problem); -- Called when no elaboration order can be found. Outputs an appropriate -- diagnosis of the problem, and then abandons the bind. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index b2c26ca4981..c4b37e788ab 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -2765,7 +2765,6 @@ package body Checks is S_Typ : Entity_Id; Arr : Node_Id := Empty; -- initialize to prevent warning Arr_Typ : Entity_Id := Empty; -- initialize to prevent warning - OK : Boolean := False; -- initialize to prevent warning Is_Subscr_Ref : Boolean; -- Set true if Expr is a subscript @@ -2995,10 +2994,11 @@ package body Checks is and then Compile_Time_Known_Value (Thi) then declare + OK : Boolean := False; -- initialize to prevent warning Hiv : constant Uint := Expr_Value (Thi); Lov : constant Uint := Expr_Value (Tlo); - Hi : Uint; - Lo : Uint; + Hi : Uint := No_Uint; + Lo : Uint := No_Uint; begin -- If range is null, we for sure have a constraint error (we @@ -4370,8 +4370,8 @@ package body Checks is Hi_Left : Uint; -- Lo and Hi bounds of left operand - Lo_Right : Uint; - Hi_Right : Uint; + Lo_Right : Uint := No_Uint; + Hi_Right : Uint := No_Uint; -- Lo and Hi bounds of right (or only) operand Bound : Node_Id; @@ -4909,8 +4909,8 @@ package body Checks is Hi_Left : Ureal; -- Lo and Hi bounds of left operand - Lo_Right : Ureal; - Hi_Right : Ureal; + Lo_Right : Ureal := No_Ureal; + Hi_Right : Ureal := No_Ureal; -- Lo and Hi bounds of right (or only) operand Bound : Node_Id; @@ -9814,7 +9814,7 @@ package body Checks is Do_Access : Boolean := False; Wnode : Node_Id := Warn_Node; Ret_Result : Check_Result := (Empty, Empty); - Num_Checks : Integer := 0; + Num_Checks : Natural := 0; procedure Add_Check (N : Node_Id); -- Adds the action given to Ret_Result if N is non-Empty diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index 8a35b82f55e..89fc286bf5b 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -2393,6 +2393,11 @@ package body Contracts is end if; end Process_Contract_Cases_For; + pragma Unmodified (Stmts); + -- Stmts is passed as IN OUT to signal that the list can be updated, + -- even if the corresponding integer value representing the list does + -- not change. + -- Start of processing for Process_Contract_Cases begin @@ -2535,6 +2540,11 @@ package body Contracts is end loop; end Process_Spec_Postconditions; + pragma Unmodified (Stmts); + -- Stmts is passed as IN OUT to signal that the list can be updated, + -- even if the corresponding integer value representing the list does + -- not change. + -- Start of processing for Process_Postconditions begin diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 70d39b7a916..79c6524769b 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -1054,7 +1054,7 @@ package body Exp_Attr is Base_Typ : constant Entity_Id := Base_Type (Etype (Pref)); Exprs : constant List_Id := Expressions (N); Aux_Decl : Node_Id; - Blk : Node_Id; + Blk : Node_Id := Empty; Decls : List_Id; Installed : Boolean; Loc : Source_Ptr; diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb index 7941cbd2ca6..c4bf096cab7 100644 --- a/gcc/ada/exp_ch11.adb +++ b/gcc/ada/exp_ch11.adb @@ -1855,11 +1855,13 @@ package body Exp_Ch11 is -- and the warning is enabled, generate the appropriate warnings. -- ??? Do not do it for the Call_Marker nodes inserted by the ABE - -- mechanism because this generates too many false positives. + -- mechanism because this generates too many false positives, or + -- for generic instantiations for the same reason. elsif Warn_On_Non_Local_Exception and then Restriction_Active (No_Exception_Propagation) and then Nkind (N) /= N_Call_Marker + and then Nkind (N) not in N_Generic_Instantiation then Warn_No_Exception_Propagation_Active (N); diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 86d488392a9..a2aa25b8d59 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -2766,7 +2766,7 @@ package body Exp_Ch4 is -- special case of setting the right high bound for a null result. -- This is of type Ityp. - High_Bound : Node_Id; + High_Bound : Node_Id := Empty; -- A tree node representing the high bound of the result (of type Ityp) Result : Node_Id; @@ -4800,7 +4800,7 @@ package body Exp_Ch4 is declare Dis : Boolean := False; - Typ : Entity_Id; + Typ : Entity_Id := Empty; begin if Has_Discriminants (T) then @@ -13112,10 +13112,10 @@ package body Exp_Ch4 is Comp : Node_Id; -- Comparison operand, set only if Is_Zero is false - Ent : Entity_Id; + Ent : Entity_Id := Empty; -- Entity whose length is being compared - Index : Node_Id; + Index : Node_Id := Empty; -- Integer_Literal node for length attribute expression, or Empty -- if there is no such expression present. diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 9d2f652f119..d98e725d85f 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -4769,8 +4769,8 @@ package body Exp_Ch5 is -- If the domain is an itype, note the bounds of its range. - L_Hi : Node_Id; - L_Lo : Node_Id; + L_Hi : Node_Id := Empty; + L_Lo : Node_Id := Empty; function Lo_Val (N : Node_Id) return Node_Id; -- Given static expression or static range, returns an identifier diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index bca7e5deae4..357979e663e 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -4721,9 +4721,11 @@ package body Exp_Ch6 is Exp : Node_Id; HSS : Node_Id; Result : Node_Id; - Return_Stmt : Node_Id; Stmts : List_Id; + Return_Stmt : Node_Id := Empty; + -- Force initialization to facilitate static analysis + -- Start of processing for Expand_N_Extended_Return_Statement begin diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index b8f6d99390f..2afd652ba4b 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -6189,8 +6189,7 @@ package body Exp_Ch9 is Cond_Id : Entity_Id; Entry_Body : Node_Id; - Func_Body : Node_Id; - pragma Warnings (Off, Func_Body); + Func_Body : Node_Id := Empty; -- Start of processing for Expand_Entry_Barrier diff --git a/gcc/ada/exp_imgv.adb b/gcc/ada/exp_imgv.adb index 78777075d8b..6f6b008f99f 100644 --- a/gcc/ada/exp_imgv.adb +++ b/gcc/ada/exp_imgv.adb @@ -436,7 +436,7 @@ package body Exp_Imgv is Imid : RE_Id; Ptyp : Entity_Id; Rtyp : Entity_Id; - Tent : Entity_Id; + Tent : Entity_Id := Empty; Ttyp : Entity_Id; Proc_Ent : Entity_Id; Enum_Case : Boolean; diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index d5e8e09c941..698bf76c2c1 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -5447,7 +5447,7 @@ package body Exp_Util is (T : Entity_Id; Iface : Entity_Id) return Entity_Id is - AI_Tag : Entity_Id; + AI_Tag : Entity_Id := Empty; Found : Boolean := False; Typ : Entity_Id := T; diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index a106d68ae86..ba81a55cfa5 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -1173,8 +1173,7 @@ package body Freeze is Component_Aliased : Boolean; - Comp_Byte_Aligned : Boolean; - pragma Warnings (Off, Comp_Byte_Aligned); + Comp_Byte_Aligned : Boolean := False; -- Set for the record case, True if Comp is aligned on byte boundaries -- (in which case it is allowed to have different storage order). diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 7096f7c7431..f97fce782f4 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -2224,13 +2224,13 @@ package body Inline is Exit_Lab : Entity_Id := Empty; F : Entity_Id; A : Node_Id; - Lab_Decl : Node_Id; + Lab_Decl : Node_Id := Empty; Lab_Id : Node_Id; New_A : Node_Id; - Num_Ret : Nat := 0; + Num_Ret : Nat := 0; Ret_Type : Entity_Id; - Targ : Node_Id; + Targ : Node_Id := Empty; -- The target of the call. If context is an assignment statement then -- this is the left-hand side of the assignment, else it is a temporary -- to which the return value is assigned prior to rewriting the call. diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index ac5035fd1bc..562653f58f4 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -5895,8 +5895,7 @@ package body Sem_Ch12 is Present (Next_Formal (First_Formal (Formal_Subp))); Decl : Node_Id; - Expr : Node_Id; - pragma Warnings (Off, Expr); + Expr : Node_Id := Empty; F1, F2 : Entity_Id; Func : Entity_Id; Op_Name : Name_Id; diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 1e3b78ccf2f..75c624b472a 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -6639,7 +6639,7 @@ package body Sem_Ch3 is Tdef : constant Node_Id := Type_Definition (N); Indic : constant Node_Id := Subtype_Indication (Tdef); Parent_Base : constant Entity_Id := Base_Type (Parent_Type); - Implicit_Base : Entity_Id; + Implicit_Base : Entity_Id := Empty; New_Indic : Node_Id; procedure Make_Implicit_Base; @@ -6751,7 +6751,7 @@ package body Sem_Ch3 is N_Subtype_Indication; D_Constraint : Node_Id; - New_Constraint : Elist_Id; + New_Constraint : Elist_Id := No_Elist; Old_Disc : Entity_Id; New_Disc : Entity_Id; New_N : Node_Id; diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index c8ef8d8e095..3102678c364 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -339,9 +339,8 @@ package body Sem_Ch4 is -------------------------- procedure List_Operand_Interps (Opnd : Node_Id) is - Nam : Node_Id; - pragma Warnings (Off, Nam); - Err : Node_Id := N; + Nam : Node_Id := Empty; + Err : Node_Id := N; begin if Is_Overloaded (Opnd) then @@ -1720,11 +1719,11 @@ package body Sem_Ch4 is else Analyze_Choices (Alternatives (N), Exp_Type); Check_Choices (N, Alternatives (N), Exp_Type, Others_Present); - end if; - if Exp_Type = Universal_Integer and then not Others_Present then - Error_Msg_N - ("case on universal integer requires OTHERS choice", Expr); + if Exp_Type = Universal_Integer and then not Others_Present then + Error_Msg_N + ("case on universal integer requires OTHERS choice", Expr); + end if; end if; end Analyze_Case_Expression; diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 10002ea08c2..14cf2e5a732 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -391,7 +391,8 @@ package body Sem_Ch5 is T1 : Entity_Id; T2 : Entity_Id; - Save_Full_Analysis : Boolean; + Save_Full_Analysis : Boolean := False; + -- Force initialization to facilitate static analysis Saved_GM : constant Ghost_Mode_Type := Ghost_Mode; -- Save the Ghost mode to restore on exit diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 5dc92d28634..266b6fef4a1 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1039,7 +1039,7 @@ package body Sem_Ch6 is --------------------- Expr : Node_Id; - Obj_Decl : Node_Id; + Obj_Decl : Node_Id := Empty; -- Start of processing for Analyze_Function_Return @@ -1190,13 +1190,16 @@ package body Sem_Ch6 is -- Case of Expr present - if Present (Expr) + if Present (Expr) then - -- Defend against previous errors + -- Defend against previous errors + + if Nkind (Expr) = N_Empty + or else No (Etype (Expr)) + then + return; + end if; - and then Nkind (Expr) /= N_Empty - and then Present (Etype (Expr)) - then -- Apply constraint check. Note that this is done before the implicit -- conversion of the expression done for anonymous access types to -- ensure correct generation of the null-excluding check associated diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index 199cd8a8c7a..98f2ccc4756 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -2287,7 +2287,7 @@ package body Sem_Ch9 is Target_Obj : Node_Id := Empty; Req_Scope : Entity_Id; Outer_Ent : Entity_Id; - Synch_Type : Entity_Id; + Synch_Type : Entity_Id := Empty; begin -- Preserve relevant elaboration-related attributes of the context which @@ -3513,10 +3513,10 @@ package body Sem_Ch9 is -- declarations. Search for the private type declaration. declare - Full_T_Ifaces : Elist_Id; + Full_T_Ifaces : Elist_Id := No_Elist; Iface : Node_Id; Priv_T : Entity_Id; - Priv_T_Ifaces : Elist_Id; + Priv_T_Ifaces : Elist_Id := No_Elist; begin Priv_T := First_Entity (Scope (T)); diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb index a271ca55960..44166002ee9 100644 --- a/gcc/ada/sem_dim.adb +++ b/gcc/ada/sem_dim.adb @@ -903,13 +903,13 @@ package body Sem_Dim is Choice : Node_Id; Dim_Aggr : Node_Id; Dim_Symbol : Node_Id; - Dim_Symbols : Symbol_Array := No_Symbols; - Dim_System : System_Type := Null_System; - Position : Nat := 0; + Dim_Symbols : Symbol_Array := No_Symbols; + Dim_System : System_Type := Null_System; + Position : Dimension_Position := Invalid_Position; Unit_Name : Node_Id; - Unit_Names : Name_Array := No_Names; + Unit_Names : Name_Array := No_Names; Unit_Symbol : Node_Id; - Unit_Symbols : Symbol_Array := No_Symbols; + Unit_Symbols : Symbol_Array := No_Symbols; Errors_Count : Nat; -- Errors_Count is a count of errors detected by the compiler so far @@ -949,13 +949,13 @@ package body Sem_Dim is Dim_Aggr := First (Expressions (Aggr)); Errors_Count := Serious_Errors_Detected; while Present (Dim_Aggr) loop - Position := Position + 1; - - if Position > High_Position_Bound then + if Position = High_Position_Bound then Error_Msg_N ("too many dimensions in system", Aggr); exit; end if; + Position := Position + 1; + if Nkind (Dim_Aggr) /= N_Aggregate then Error_Msg_N ("aggregate expected", Dim_Aggr); diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 0c6c2ea7472..01eb8144e68 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -2301,7 +2301,7 @@ package body Sem_Eval is Left_Str : constant Node_Id := Get_String_Val (Left); Left_Len : Nat; Right_Str : constant Node_Id := Get_String_Val (Right); - Folded_Val : String_Id; + Folded_Val : String_Id := No_String; begin -- Establish new string literal, and store left operand. We make diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb index ad8c388c616..886c2b4f432 100644 --- a/gcc/ada/sem_intr.adb +++ b/gcc/ada/sem_intr.adb @@ -101,7 +101,7 @@ package body Sem_Intr is Nam : constant Entity_Id := Entity (Name (N)); Arg1 : constant Node_Id := First_Actual (N); Typ : Entity_Id; - Rtyp : Entity_Id; + Rtyp : Entity_Id := Empty; Cnam : Name_Id; Unam : Node_Id; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 596f306af3d..78876ffbf25 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -28747,7 +28747,7 @@ package body Sem_Prag is Depends : Node_Id; Formal : Entity_Id; Global : Node_Id; - Spec_Id : Entity_Id; + Spec_Id : Entity_Id := Empty; Subp_Decl : Node_Id; Typ : Entity_Id; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 49a654f8fd6..8646cc06fba 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -1212,7 +1212,7 @@ package body Sem_Res is Func : constant Entity_Id := Entity (Name (N)); Is_Binary : constant Boolean := Present (Act2); Op_Node : Node_Id; - Opnd_Type : Entity_Id; + Opnd_Type : Entity_Id := Empty; Orig_Type : Entity_Id := Empty; Pack : Entity_Id; @@ -1523,6 +1523,7 @@ package body Sem_Res is -- Operator may be defined in an extension of System elsif Present (System_Aux_Id) + and then Present (Opnd_Type) and then Scope (Opnd_Type) = System_Aux_Id then null; diff --git a/gcc/ada/sem_spark.ads b/gcc/ada/sem_spark.ads index d7abd8ad74a..d6977880d47 100644 --- a/gcc/ada/sem_spark.ads +++ b/gcc/ada/sem_spark.ads @@ -27,10 +27,10 @@ -- rules that are enforced are defined in the anti-aliasing section of the -- SPARK RM 6.4.2 -- --- Analyze_SPARK is called by Gnat1drv, when GNATprove mode is activated. It --- does an analysis of the source code, looking for code that is considered --- as SPARK and launches another function called Analyze_Node that will do --- the whole analysis. +-- Check_Safe_Pointers is called by Gnat1drv, when GNATprove mode is +-- activated. It does an analysis of the source code, looking for code that is +-- considered as SPARK and launches another function called Analyze_Node that +-- will do the whole analysis. -- -- A path is an abstraction of a name, of which all indices, slices (for -- indexed components) and function calls have been abstracted and all diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 0e498d3e6cb..ff94cf84e41 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -3344,7 +3344,8 @@ package body Sem_Warn is ----------------------------- procedure Warn_On_Known_Condition (C : Node_Id) is - Test_Result : Boolean; + Test_Result : Boolean := False; + -- Force initialization to facilitate static analysis function Is_Known_Branch return Boolean; -- If the type of the condition is Boolean, the constant value of the diff --git a/gcc/ada/set_targ.adb b/gcc/ada/set_targ.adb index f25c9f84f81..93b71018d89 100755 --- a/gcc/ada/set_targ.adb +++ b/gcc/ada/set_targ.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2013-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 2013-2017, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -580,6 +580,7 @@ package body Set_Targ is -- Checks that we have one or more spaces and skips them procedure FailN (S : String); + pragma No_Return (FailN); -- Calls Fail adding " name in file xxx", where name is the currently -- gathered name in Nam_Buf, surrounded by quotes, and xxx is the -- name of the file. diff --git a/gcc/ada/stylesw.adb b/gcc/ada/stylesw.adb index ff8155adfc9..6f258626b07 100644 --- a/gcc/ada/stylesw.adb +++ b/gcc/ada/stylesw.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2017, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -150,10 +150,6 @@ package body Stylesw is -- Start of processing for Save_Style_Check_Options begin - for K in Options'Range loop - Options (K) := ' '; - end loop; - Add (Character'Val (Style_Check_Indentation + Character'Pos ('0')), Style_Check_Indentation /= 0);