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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9d66743a9fdd96bd X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: question about functions Date: 2000/01/21 Message-ID: #1/1 X-Deja-AN: 575869382 References: <8690q7$8tc$1@news.mgn.net> <38889682.ACA87787@Raytheon.com> X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov X-Trace: skates.gsfc.nasa.gov 948486163 4111 128.183.220.71 (21 Jan 2000 20:22:43 GMT) Organization: NASA Goddard Space Flight Center NNTP-Posting-Date: 21 Jan 2000 20:22:43 GMT Newsgroups: comp.lang.ada Date: 2000-01-21T20:22:43+00:00 List-Id: "Samuel T. Harris" writes: > tmoran@bix.com wrote: > > The compiler may pass A and B in registers instead of > on the stack. In this case a'address and b'address > will cause runtime errors. VADS on SGI IRIX causes > a either a bus error or segmentation fault (I can't > remember now) for a similar subprogram we needed. > > To get around this, you need temps for A and B, ala ... > > function ADD (A, B : in T) return T is > temp_a : t := a; > temp_b : t := b; > result : t; > begin > proc (temp_a'address, temp_b'address, result'address); > return result; > end; > > In our case VADS was not smart enough to recognize that > the usage of the parameters includes a 'address attribution > which should preclude passing A and B in registers. Given > the other complex data flow analysis employed by the > compiler for other optimizations, this seems a reasonable > check. > > Of course VADS is Ada 83. Perhaps the language laywers > in the news group can expound on any new Ada 95 rules > which eliminates this situation? At a guess, adding 'aliased' should help. Or pragma Volatile. -- Stephe