https://gcc.gnu.org/g:a550f2309cdb776dce9876c52a433ff77737e8fd

commit r16-2750-ga550f2309cdb776dce9876c52a433ff77737e8fd
Author: Viljar Indus <in...@adacore.com>
Date:   Tue Jul 22 10:17:59 2025 +0300

    ada: Fix code quality issue in table.adb
    
    gcc/ada/ChangeLog:
    
            * table.adb (Max): Move variable to the body and initialize
            it with the same value as in the Init function.
            * table.ads (Max): Likewise.

Diff:
---
 gcc/ada/table.adb | 3 +++
 gcc/ada/table.ads | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/table.adb b/gcc/ada/table.adb
index 37c49494197c..31891de87db4 100644
--- a/gcc/ada/table.adb
+++ b/gcc/ada/table.adb
@@ -40,6 +40,9 @@ package body Table is
       Min : constant Int := Int (Table_Low_Bound);
       --  Subscript of the minimum entry in the currently allocated table
 
+      Max : Int := Min + (Table_Initial * Table_Factor) - 1;
+      --  Subscript of the maximum entry in the currently allocated table
+
       Length : Int := 0;
       --  Number of entries in currently allocated table. The value of zero
       --  ensures that we initially allocate the table.
diff --git a/gcc/ada/table.ads b/gcc/ada/table.ads
index 22e9172bc480..623ce14711b9 100644
--- a/gcc/ada/table.ads
+++ b/gcc/ada/table.ads
@@ -223,9 +223,6 @@ package Table is
       --  the official interfaces (since a modification to Last may require a
       --  reallocation of the table).
 
-      Max : Int;
-      --  Subscript of the maximum entry in the currently allocated table
-
       type Saved_Table is record
          Last_Val : Int;
          Max      : Int;

Reply via email to