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 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.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: Fri, 15 Oct 2004 10:05:32 +0200 Organization: AdaCL Message-ID: <6545303.EbTl0XcSZp@linux1.krischik.com> References: <35f054ea.0410140733.5f250e6f@posting.google.com> <1427975.D57Qmkl0pE@linux1.krischik.com> <416F1EA4.5080700@acm.org> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8Bit X-Trace: news.t-online.com 1097827652 05 4003 0njRXRbO68ZsSnF1 041015 08:07:32 X-Complaints-To: usenet-abuse@t-online.de X-ID: TJfH6BZOoeXTFc-nMJOlHWjF6Q7sRJtX3PqfhlsInXzSaHlcAgLpYR User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:5240 Date: 2004-10-15T10:05:32+02:00 List-Id: Arthur Schwarz wrote: > Martin Krischik wrote: > >> skidmarks wrote: > >> >> 1st: only aliased data is guaranteed to have an 'Address. Even non inline >> functions may use a register for certain data. > Going back to the 'Address issue, it is my (unsubstantiated) belief > that if the semantics are to be the same for inline and non-inline > code, then it should be the compilers responsibility to ensure > that argument passage is guaranteed to be correct. Otherwise any > argument passed to a subprogram becomes suspect as being able to > generate a fault at runtime. Yes. Depending on compiler/cpu the non inlined version might not work either. Unless you use some representation clause the compiler has a lot of freedom to perform the parameter passing. You need to ensure the data does indeed have an address. i.E.: ���function�Push(�Datum�:�access Datum_Type�)�return�List.Cell_Ptr�is ������LM_Datum�:�List.Datum_Type; �����������������for�LM_Datum'Address�use�Datum.all'Address; ���begin�--�Push �����return�List.Push(LM_Datum); ���end�Push; ���pragma�inline(�Push�); By passing an access you force the compiler to make sure an address is available. > My objection is that the non-inlined code, with all it's conceptual > and design flaws, works as expected. The inline code fails at run- > time without a diagnostic message at compile time. My expectation > was that the results of inline execution and non-inline execution > should have been the same. Yes, they should both fail. Again: only aliased data is guaranteed to have an 'Address. There are rules in Ada for Pass by Reference and Free to Choose. Free to Choose is the largest group. Pass on Stack is only needed for "Pragma Export" and "Pragma Import". So an PowerPC or 68xxxx CPU which have lots of registers even the non inlined version may use register and pass by copy for parameter passing. > And so I am confused. The question is still whether Ada requires > that the result of execution of the inline and non-inline code to > be the same, and if not the same, what variances are permitted. The non inlined version only works because you where luck. However, there is just one thing where you should go back to your verndor and insist on a bug to be fixed: PROGRAM_ERROR should have been raised. And most compilers issue a warning when the code for PROGRAM_ERROR is generated. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com