From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,72010b3539d2f8cb,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!a11g2000pri.googlegroups.com!not-for-mail From: ytomino Newsgroups: comp.lang.ada Subject: gneric package breaks the restriction of No_Elaboration_Code ? Date: Mon, 28 Feb 2011 02:26:40 -0800 (PST) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 118.8.55.60 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1298889108 15070 127.0.0.1 (28 Feb 2011 10:31:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 28 Feb 2011 10:31:48 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: a11g2000pri.googlegroups.com; posting-host=118.8.55.60; posting-account=Mi71UQoAAACnFhXo1NVxPlurinchtkIj User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.102 Safari/534.13,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:17635 Date: 2011-02-28T02:26:40-08:00 List-Id: Hello. I found unnecessary elaboration code is generated that is probably caused by generic instantiation. Please look the sources in below: ---- 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.ads ---- 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; ---- t_m.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; end t_i; ----------------- And comple these, look b~t_m.adb. % 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 ---- b~t_m.adb ---- ... procedure adainit is E2 : Boolean; pragma Import (Ada, E2, "t_i_E"); begin null; t_i'elab_spec; -- *2 E2 := True; end adainit; ... ------------------- Also, I used nm, found __elabs procedure. % nm t_i.o 00000261 D _t_i_E 00000008 T _t_i___elabs 00000000 T _t_i__nested Next, remove generic instantiation (*1), and re-compile these, then, elaboration code disappeared from adainit in b~t_m.adb. ---- b~t_m.adb ---- ... procedure adainit is begin null; end adainit; ... ------------------- __elabs procedure disappeared too. % nm t_i.o 00000025 D _t_i_E I think this is gcc's bug. (I tried with gcc-4.5.1/4.5.2) Or, possibly this is correct on the spec ?