[Bug ada/56474] New: GNAT computes size of the object to be allocated incorrectly

pavel at zhukoff dot net gcc-bugzilla@gcc.gnu.org
Wed Feb 27 17:41:00 GMT 2013


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: unassigned@gcc.gnu.org
        ReportedBy: pavel@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



More information about the Gcc-bugs mailing list