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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1676be4fafed1dbb,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Semantics of Inline vs non-Inline Date: Thu, 14 Oct 2004 19:58:16 +0200 Organization: AdaCL Message-ID: <1427975.D57Qmkl0pE@linux1.krischik.com> References: <35f054ea.0410140733.5f250e6f@posting.google.com> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1097777086 03 22822 tpHRXTALuPAkdQ5 041014 18:04:46 X-Complaints-To: usenet-abuse@t-online.de X-ID: bi5St4ZEwezUEp54dDXLS7M3O0f5J3wQMDNxMJ+2j1Hh8n86SHm7QU User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:5213 Date: 2004-10-14T19:58:16+02:00 List-Id: skidmarks wrote: > My compiler vendor says that the semantics of an inline/non-inline > function can be different at the discretion of the compiler vendor. In > particular, if at the point of use of an inline function the value of > an argument (to the defined subprogram) is in a register, then it is > acceptable to 'crash' because the address of the argument is not known > (it's in a register). > > My claim is that the semantics of of an inline and non-inline > subprogram must be identical, and further, the application writer is > both unaware and should be unaware of the code generated at the point > of subprogram use. > > Any idea which view is the correct one? > > Art > > ---------------------------------------------------------- > Example (in truncated pseudo-Ada): > > package body x is > subtype Datum_Type is Natural; > package List is new abc.List_Manager( ); > function Push( Datum : Datum_Type ) return List.Cell_Ptr is > LM_Datum : List.Datum_Type; > for LM_Datum'Address use Datum'Address; > begin -- Push > return List.Push(LM_Datum); > end Push; > pragma inline( Push ); > > Cell : List.Cell_Ptr; > thing: Natural; > begin -- x > Cell := Push(thing); > end x; > > This code does not work with 'pragma inline'. > This code does work without 'pragma inline'. > > The vendor claims that the address of 'thing' is not known at the call > (it may be in a register) and hence the inlined 'Push' does not have a > valid input argument. My first statement is that the behavior for > inline/non-inline should be the same, and that if it succeeds in one > it should succeed in all. Is this a correct interpretation? 1st: only aliased data is guaranteed to have an 'Address. Even non inline functions may use a register for certain data. 2nd: You must see 'Address as some form of Unchecked_Conversion - actually the way you have used 'Address it is Unchecked_Unchecked_Conversion - that's is the way a "reinterpret_cast <>" (if you know C++) is done in Ada. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com