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.85.134 with SMTP id h6mr2914774wiz.1.1367665736085; Sat, 04 May 2013 04:08:56 -0700 (PDT) Path: hg5ni66826wib.1!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.139.MISMATCH!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!nrc-news.nrc.ca!News.Dal.Ca!news.litech.org!news.etla.org!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: Erroneous code generation from GNAT or GCC? Date: Tue, 30 Apr 2013 19:04:11 +0200 Organization: Ada @ Home Message-ID: References: NNTP-Posting-Host: gFlCVqYhFMvL17n7JqXJeg.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-30T19:04:11+02:00 List-Id: Le Tue, 30 Apr 2013 08:40:35 +0200, Simon Wright a = = =C3=A9crit: > I suspect that the problem may be the 'clobber'. In [1], it says "You > may not write a clobber description in a way that overlaps with an inp= ut > or output operand. For example, you may not have an operand describing= a > register class with one member if you mention that register in the > clobber list." So the clobber description is for registers that are > overwritten implicitly. You're right about clobber, and GNAT takes care of it, when it tells you= = the constraint cannot be satisfied if you use a register for both = input/output and in the clobber list. In my use case, I don't use clobber, so that cannot be the reason. I = didn't need it, as everything is explicit and the whole statement is = volatile. The issue in this thread seems to not be directly addressable with clobb= er = of volatile applied to the machine=E2=80=91code statement; that's an iss= ue with = indirection: a register holds an address to something, and the object at= = that address must be made volatile, or else it may be optimized out. So = I = wondered if when passing an address to something (the compiler knows if = = comes from an address attribute), if this makes sense to generate the = address to the object while dropping the Ada instructions which creates = = this object. That's why I said =E2=80=9Cmay be GNAT or GCC are lacking s= ome = semantic dependency tracking here=E2=80=9D. That's just a question, I'm = not sure = of the answer and just personally believe if the address is generated an= d = passed, then this should imply the Ada instructions creating the object = = should not be dropped. In the mean time, that's output to the external world, and it most of ti= me = requires representation conversion which implies copying, so I will go = with copying to volatile buffers and consider it as a similar issue as = representation conversion is. >> Beside this, I noted something from the RM: >> >> http://www.adaic.org/resources/add_content/standards/05aarm/html/AA-1= 3-8.html >>> If a subprogram_body contains any code_statements, then >>> within this subprogram_body the only allowed form of statement >>> is a code_statement (labeled or not), the only allowed = >>> declarative_items >>> are use_clauses, and no exception_handler is allowed (comments and >>> pragmas >>> are allowed as usual). >> >> This seems to mean object declarations are not allowed in this >> context. But I did use object declarations in this context and GNAT >> did not complained. Which is right and which is wrong? > > [2] says that the procedure version of the Asm subprograms "can be use= d > anywhere a procedure call would be valid, and correspond to what the R= M > calls "intrinsic" routines. Such calls can be used to intersperse > machine instructions with other Ada statements.". So when the RM says =E2=80=9Cif a subprogram_body contains any code_stat= ements=E2=80=9D, = what is the subject sub=E2=80=91program body? I though it was the body c= ontaining = the `Asm` sub=E2=80=91program. Or may be it's the `Asm` sub=E2=80=91prog= ram itself? That's not a big issue, that's just that I prefer to stick to the RM whe= n = feasible, and if I have to write things a different way to conform to th= e = RM, I will do so. -- = =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