public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "demoonlit at panathenaia dot halfmoon.jp" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/48013] New: generic instantiation breaks the restriction of No_Elaboration_Code
Date: Mon, 07 Mar 2011 08:27:00 -0000	[thread overview]
Message-ID: <bug-48013-4@http.gcc.gnu.org/bugzilla/> (raw)

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.)


             reply	other threads:[~2011-03-07  8:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07  8:27 demoonlit at panathenaia dot halfmoon.jp [this message]
2014-11-10 12:50 ` [Bug ada/48013] " fxcoudert at gcc dot gnu.org
2015-09-01 23:25 ` demoonlit at panathenaia dot halfmoon.jp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-48013-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).