http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56474



             Bug #: 56474

           Summary: GNAT computes size of the object to be allocated

                    incorrectly

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: critical

          Priority: P3

         Component: ada

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: pa...@zhukoff.net





100% reproducible



Smaller reproducer:



with Ada.Streams;



package Pkg is

   use type Ada.Streams.Stream_Element_Offset;



   type Vector (Size : Ada.Streams.Stream_Element_Offset) is record

      Value : Ada.Streams.Stream_Element_Array (0 .. Size);

   end record;



   Empty_Vector : Vector (-1);



end Pkg;



with Pkg;

procedure Bbb is

begin

   null;

end Bbb;



$ gnatmake bbb

gcc -c bbb.adb

gcc -c pkg.ads

pkg.ads:10:04: warning: "Storage_Error" will be raised at run time

gnatbind -x bbb.ali

gnatlink bbb.ali



$ ./bbb



raised STORAGE_ERROR : object too large

Reply via email to