aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2018-05-23 10:23:39 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-23 10:23:39 +0000
commitbc3fb397fd7be2935d9122bb9d1972e701aae83f (patch)
tree5e22590fe5c4ffbabc4052c17d307c92dc259e36
parentb77c24b8c0e484181de399ac7c46f2749add582d (diff)
downloadgcc-bc3fb397fd7be2935d9122bb9d1972e701aae83f.zip
gcc-bc3fb397fd7be2935d9122bb9d1972e701aae83f.tar.gz
gcc-bc3fb397fd7be2935d9122bb9d1972e701aae83f.tar.bz2
[Ada] Fix various defects found by static analysis
2018-05-23 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * checks.adb (Minimize_Eliminate_Overflows): Default initialize Lo and Hi. * sem_elab.adb: Make "out" parameters instead of "in out" when relevant. From-SVN: r260594
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/checks.adb6
-rw-r--r--gcc/ada/sem_elab.adb16
3 files changed, 21 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d77cecb..5a34dee 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2018-05-23 Arnaud Charlet <charlet@adacore.com>
+
+ * checks.adb (Minimize_Eliminate_Overflows): Default initialize Lo and
+ Hi.
+ * sem_elab.adb: Make "out" parameters instead of "in out" when
+ relevant.
+
2018-05-23 Bob Duff <duff@adacore.com>
* gnatbind.adb (List_Applicable_Restrictions): Add
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index d88caad..9fb775f 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -8379,6 +8379,12 @@ package body Checks is
-- Start of processing for Minimize_Eliminate_Overflows
begin
+ -- Default initialize Lo and Hi since these are not guaranteed to be
+ -- set otherwise.
+
+ Lo := No_Uint;
+ Hi := No_Uint;
+
-- Case where we do not have a signed integer arithmetic operation
if not Is_Signed_Integer_Arithmetic_Op (N) then
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
index 0b369ea..cfc21b1 100644
--- a/gcc/ada/sem_elab.adb
+++ b/gcc/ada/sem_elab.adb
@@ -4494,27 +4494,27 @@ package body Sem_Elab is
procedure Transition_Body_Declarations
(Bod : Node_Id;
- Curr : in out Node_Id);
+ Curr : out Node_Id);
pragma Inline (Transition_Body_Declarations);
-- Update the Curr and Start pointers when construct Bod denotes a block
-- statement or a suitable body. This routine raises ECR_Found.
procedure Transition_Handled_Statements
(HSS : Node_Id;
- Curr : in out Node_Id);
+ Curr : out Node_Id);
pragma Inline (Transition_Handled_Statements);
-- Update the Curr and Start pointers when node HSS denotes a handled
-- sequence of statements. This routine raises ECR_Found.
procedure Transition_Spec_Declarations
(Spec : Node_Id;
- Curr : in out Node_Id);
+ Curr : out Node_Id);
pragma Inline (Transition_Spec_Declarations);
-- Update the Curr and Start pointers when construct Spec denotes
-- a concurrent definition or a package spec. This routine raises
-- ECR_Found.
- procedure Transition_Unit (Unit : Node_Id; Curr : in out Node_Id);
+ procedure Transition_Unit (Unit : Node_Id; Curr : out Node_Id);
pragma Inline (Transition_Unit);
-- Update the Curr and Start pointers when node Unit denotes a potential
-- compilation unit. This routine raises ECR_Found.
@@ -4907,7 +4907,7 @@ package body Sem_Elab is
procedure Transition_Body_Declarations
(Bod : Node_Id;
- Curr : in out Node_Id)
+ Curr : out Node_Id)
is
Decls : constant List_Id := Declarations (Bod);
@@ -4935,7 +4935,7 @@ package body Sem_Elab is
procedure Transition_Handled_Statements
(HSS : Node_Id;
- Curr : in out Node_Id)
+ Curr : out Node_Id)
is
Bod : constant Node_Id := Parent (HSS);
Decls : constant List_Id := Declarations (Bod);
@@ -4986,7 +4986,7 @@ package body Sem_Elab is
procedure Transition_Spec_Declarations
(Spec : Node_Id;
- Curr : in out Node_Id)
+ Curr : out Node_Id)
is
Prv_Decls : constant List_Id := Private_Declarations (Spec);
Vis_Decls : constant List_Id := Visible_Declarations (Spec);
@@ -5048,7 +5048,7 @@ package body Sem_Elab is
procedure Transition_Unit
(Unit : Node_Id;
- Curr : in out Node_Id)
+ Curr : out Node_Id)
is
Context : constant Node_Id := Parent (Unit);