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

            Bug ID: 81961
           Summary: [7 regression] an imported unsized C array in the
                    auto-translated binding raises Storage_Error
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: demoonlit at panathenaia dot halfmoon.jp
  Target Milestone: ---

For example, translate a C header like following x.h with -fdump-ada-spec.

==== x.h ====
extern int unsized[];
=============

$ gcc -c -fdump-ada-spec x.h

$ cat x_h.ads
pragma Ada_2005;
pragma Style_Checks (Off);

with Interfaces.C; use Interfaces.C;

package x_h is

   unsized : aliased array (size_t) of aliased int;  -- x.h:1
   pragma Import (C, unsized, "unsized");

end x_h;

And prepare a main routine, compile and execute it.

==== main.adb ====
with x_h;
procedure main is
begin
   null;
end main;
==================

$ gnatmake main
gcc -c main.adb
gnatbind -x main.ali
gnatlink main.ali

$ ./main

raised STORAGE_ERROR : x_h.ads:8 object too large

This exception has been not appeared with gcc-6.

Reply via email to