https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105212

            Bug ID: 105212
           Summary: -gnatwu gives false error message for certain arrays.
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: service at totalplanlos dot de
  Target Milestone: ---

If you use the "-gnatwu" (unused entities) warning, index values of an array
are explicitly set (with "=>") and the total number of elements of the array
exceeds 64, then a false warning occurs. It is not important whether the
explicit specification is made with "others => 1" or with "1 => 1, 2 => 1, .. ,
65 => 1". Without an explicit definition like "1, 1, .. , 1" this wrong message
does not appear. Also applies to arrays with multiple dimensions.

First Example:

   procedure Test is

      type OneArray is array (1 .. 65) of Integer;
      -- (1 .. 64) gives no wrong error message.
      One : OneArray;

   begin

      One := (others => 10);

   end Test;


Second Example:

   with AnotherFile;

   procedure Main
   is begin

      AnotherFile.Two := (others => 10);

   end Main;


   package AnotherFile is

      type TwoArray is array (1 .. 65) of Integer;
      Two : TwoArray;

   end AnotherFile;


Tested with Debian Gnat 12-20220319-1, Debian Gnat 11.2.0-19 and Alire Gnat
11.2, occurs every time.

Reply via email to