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

            Bug ID: 121576
           Summary: GNAT allows for array component sizes that are too
                    small for fixed point numbers
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liam at liampwll dot com
                CC: dkm at gcc dot gnu.org
  Target Milestone: ---

As shown by the below example, GNAT silently and incorrectly allows for array
component sizes that are too small for fixed point numbers.

pragma Ada_2022;
with Ada.Text_IO;

procedure Example is
   type Fixed_Point is delta 2.0**(-8) range 0.0 .. 1.0 - 2.0**(-8);

   type Arr is array (Boolean) of Fixed_Point with Component_Size => 1;

   Foo : Arr := (others => 0.99);
   Bar : Fixed_Point := 0.99;
begin
   Ada.Text_IO.Put_Line (Foo'Image);
   Ada.Text_IO.Put_Line (Bar'Image);
end Example;

Reply via email to