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

           Summary: The executable file hangs up by combination of
                    controlled-type, generic, renames and Inline_Always
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: demoon...@panathenaia.halfmoon.jp


Created attachment 23564
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23564
minimal bug triggering source code

My application hangs up conpilied with gcc-4.5.2.

1. declare a controlled-type (named T) as private.
2. declare a generic function (named G) return T.
3. instantiate G.
4. declare a function (named F) renames it, and write pramga Inline_Always.
5. call F, it may hang up!

Probably, an object of T is attached to a finalization list, twice.

-- iacm.adb

with iact;
with iacp;
procedure iacm is
   X : iact.T := iacp.F; -- hang up !!
begin
    null;
end iacm;

-- iact.ads

with Ada.Finalization;
package iact is
   type T is private; -- hidden controll type
   generic function G return T;
private
   type T is new Ada.Finalization.Controlled with null record;
end iact;

-- iact.adb

package body iact is
   function G return T is
   begin
      return (Ada.Finalization.Controlled with null record);
   end G;
end iact;

-- iacp.ads

with iact;
package iacp is
   function F return  iact.T;
   pragma Inline_Always (F); -- this pragma causes hang up
private
   function G is new iact.G;
   function F return iact.T renames G;
end iacp;

% gnatmake iacm
gcc -c iacm.adb
gcc -c iacp.ads
gcc -c iact.adb
gnatbind -x iacm.ali
gnatlink iacm.ali

% ./iacm 
( hang up !! )

Reply via email to