comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: question about functions
Date: 2000/01/21
Date: 2000-01-21T20:22:43+00:00	[thread overview]
Message-ID: <uln5jjhz8.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 38889682.ACA87787@Raytheon.com

"Samuel T. Harris" <samuel_t_harris@Raytheon.com> writes:

> tmoran@bix.com wrote:
> <snip> 
> 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




  reply	other threads:[~2000-01-21  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-21  0:00 question about functions Pascal LEJEUNE
2000-01-21  0:00 ` tmoran
2000-01-21  0:00   ` Samuel T. Harris
2000-01-21  0:00     ` Stephen Leake [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-01-20  0:00 Pascal LEJEUNE
2000-01-20  0:00 ` Tucker Taft
2000-01-20  0:00 ` Stephen Leake
2000-01-22  0:00   ` Matthew Heaney
2000-01-24  0:00     ` Stephen Leake
2000-01-25  0:00       ` Matthew Heaney
2000-01-27  0:00         ` Stephen Leake
2000-01-24  0:00     ` Mats Weber
2000-01-22  0:00   ` Andy
2000-01-22  0:00     ` Matthew Heaney
2000-01-24  0:00     ` Stephen Leake
2000-01-20  0:00 ` David Starner
2000-01-20  0:00 ` Hyman Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox