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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,461d464a39a7a30a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 X-Received: by 10.180.87.193 with SMTP id ba1mr2910825wib.0.1367665358845; Sat, 04 May 2013 04:02:38 -0700 (PDT) Path: hg5ni66809wib.1!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.138.MISMATCH!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!nrc-news.nrc.ca!News.Dal.Ca!news.litech.org!news.stack.nl!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: =?utf-8?B?R05BVCBub3QgZ2VuZXJhdGluZyBhbnkgY29kZSBmb3Igc3Vi4oCRcHJvZ3I=?= =?utf-8?B?YW06IGtub3duIGJ1Zz8=?= Date: Sun, 28 Apr 2013 01:48:42 +0200 Organization: Ada @ Home Message-ID: References: NNTP-Posting-Host: ZOt+glEqAP8SwP/H/SQpKw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.15 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2013-04-28T01:48:42+02:00 List-Id: Le Sun, 28 Apr 2013 00:22:41 +0200, Yannick Duch=C3=AAne (Hibou57) = a =C3=A9crit: > Le Sat, 27 Apr 2013 23:08:52 +0200, Yannick Duch=C3=AAne (Hibou57) = > a =C3=A9crit: > >> Hi all, >> >> I will make a stripped=E2=80=91down version of the case, later. > > Here is: > http://www.les-ziboux.rasama.org/download/2013-04-28-cla-gnat-bug.zip > > The bug disappears when optimization is disabled or else when the = > sub=E2=80=91program is made inlinable. Seems there is an issue with sub=E2=80=91program using Ada's machine=E2=80= =91code = insertion. If the sub=E2=80=91program which contains machine=E2=80=91code insertion= is not inlined, = then the machine=E2=80=91code insertion part gets dropped by compiler = optimization, which so seems to be more a GCC bug than a GNAT bug. The = sub=E2=80=91programs invoke this sub=E2=80=91program either directly or = indirectly, also = has to all be inlined too. There is a work=E2=80=91around: implement the sub=E2=80=91program using = machine=E2=80=91code = insertion as a generic, say `GP`. Then implement `P` which use an = instantiation of `GP` internally, and it will works. `GP` cannot be = declared inlined, or else you will get a GNAT bug=E2=80=91box. However, = if `P` = declared inlined, then its containing `GP` instantiation will be properl= y = inlined. `P` will be generated when it's either inlined or not = (effectively workaround the bug), and will be really fully inline if = declared inlined (no efficiency cost). Template as a summary: generic =E2=80=A6 procedure/function GP (=E2=80=A6); -- No `Inline` here! either `True` or `False`, -- or else GNAT says =E2=80=9Ckaboom=E2=80=9D. procedure/function GP (=E2=80=A6) is begin -- Machine code insertion here end; procedure/function P (=E2=80=A6) [with Inline =3D> True/False]; -- Works with either of the three. procedure/function P (=E2=80=A6) is procedure/function Implementation is new GP (=E2=80=A6); begin [return] Implementation (=E2=80=A6); end; -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity