From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26379 invoked by alias); 7 Mar 2011 08:27:31 -0000 Received: (qmail 26371 invoked by uid 22791); 7 Mar 2011 08:27:30 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Mar 2011 08:27:24 +0000 From: "demoonlit at panathenaia dot halfmoon.jp" To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/48013] New: generic instantiation breaks the restriction of No_Elaboration_Code X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ada X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: demoonlit at panathenaia dot halfmoon.jp X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 07 Mar 2011 08:27:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg00566.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48013 Summary: generic instantiation breaks the restriction of No_Elaboration_Code Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned@gcc.gnu.org ReportedBy: demoonlit@panathenaia.halfmoon.jp Created attachment 23565 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23565 minimal bug triggering source code Unnecessary elaboration code is generated by generic instantiation with gcc-4.5.1/4.5.2/4.6.0(experimental at 20110225). 1. instantiate any generic package/subprogram in the library-level package. 2. gnatbind an application including this package. pragma Restrictions (No_Elaboration_Code) and pragma No_Run_Time are not effective in this problem. I expected that elaboration code will be removed or reported warning/error by Restrictions (No_Elaboration_Code). -- t_m.adb pragma Restrictions (No_Elaboration_Code); pragma No_Run_Time; with t_i; procedure t_m is begin null; end t_m; -- t_g.ads pragma Restrictions (No_Elaboration_Code); pragma No_Run_Time; generic procedure t_g; pragma Pure (t_g); -- t_g.adb pragma Restrictions (No_Elaboration_Code); pragma No_Run_Time; procedure t_g is begin null; end t_g; -- t_i.adb pragma Restrictions (No_Elaboration_Code); pragma No_Run_Time; with t_g; package t_i is pragma Pure (t_i); procedure nested is new t_g; -- *1 end t_i; % gnatmake -g t_m gcc -c -g t_m.adb gcc -c -g t_i.ads gcc -c -g t_g.adb gnatbind -x t_m.ali gnatlink t_m.ali -g Look adainit in b~t_m.adb. procedure adainit is E2 : Boolean; pragma Import (Ada, E2, "t_i_E"); begin null; t_i'elab_spec; -- it violates No_Elaboration_Code ! E2 := True; end adainit; % nm t_i.o 00000261 D _t_i_E 00000008 T _t_i___elabs 00000000 T _t_i__nested (Remove generic instantiation (*1), and re-compile these, then, elaboration code disappeared from adainit in b~t_m.adb and __elabs procedure disappeared from t_i.o too.)