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 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.76.194 with SMTP id m2mr2918674wiw.4.1367665882656; Sat, 04 May 2013 04:11:22 -0700 (PDT) Path: p18ni66813wiv.0!nntp.google.com!feeder1.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!backlog1.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!nrc-news.nrc.ca!News.Dal.Ca!news.litech.org!news0.firedrake.org!cs.uu.nl!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Erroneous code generation from GNAT or GCC? Date: Tue, 30 Apr 2013 20:06:09 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Injection-Info: mx05.eternal-september.org; posting-host="32bbea2852c3ac5f339194c0aa5925ed"; logging-data="21450"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UV85SfCr1FIIOAeNz6rz4HNj8kKddWbg=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin) Cancel-Lock: sha1:VLs+shGGt/wC9GE0CVFuVib4NDI= sha1:keZcY7LyLT7nZ+Rf5MFDIO6UdzE= X-Original-Bytes: 3076 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Date: 2013-04-30T20:06:09+01:00 List-Id: "Yannick Duchêne (Hibou57)" writes: > So when the RM says "if a subprogram_body contains any > code_statements", what is the subject sub‑program body? I though it > was the body containing the 'Asm' sub‑program. Or may be it's the > 'Asm' sub‑program itself? The whole thing is bizarre: code statements are written using the form of a qualified expression though clearly not a qualified expression since it can't be assigned anywhere! Each qualified expression typically represents one machine code instruction or assembly directive. If you are implementing a function using code statements you are expected to know the calling convention, so that you can return the result in the corrct way. Clearly none of these apply to the code you wrote, so - I think - GNAT takes advantage of the implementation permission in ARM13.8(11) [1] to support intrinsic subprograms without all those tiresome restrictions. As described in [2]. [2] also recommends using Volatile => True in most circumstances. > That's not a big issue, that's just that I prefer to stick to the RM > when feasible, and if I have to write things a different way to > conform to the RM, I will do so. Since everything to do with code statements/intrinsic subprograms is compiler- and target-dependent, I don't see what you gain by this! I was wondering what you meant by using constraints "a", "b", "c", "d" .. I now see [3] that these are i386 constraints for the a..d registers respectively, no wonder they gave wierd results on x86_64 where they mean something quite different! [1] http://www.ada-auth.org/standards/12rm/html/RM-13-8.html#p11 [2] http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gnat_rm/Machine-Code-Insertions.html [3] http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Machine-Constraints.html