From: "Samuel T. Harris" <samuel_t_harris@Raytheon.com>
Subject: Re: question about functions
Date: 2000/01/21
Date: 2000-01-21T00:00:00+00:00 [thread overview]
Message-ID: <38889682.ACA87787@Raytheon.com> (raw)
In-Reply-To: VmUh4.255$bT1.11162@nnrp2-w.snfc21.pbi.net
tmoran@bix.com wrote:
>
> function ADD (A, B : in T) return T is
> tmp : T;
> begin
> -- call a procedure which use directly the hardware :
> proc (a'address, b'address, tmp'address);
> return tmp;
> end ADD;
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?
--
Samuel T. Harris, Principal Engineer
Raytheon, Aerospace Engineering Services
"If you can make it, We can fake it!"
next prev parent 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 [this message]
2000-01-21 0:00 ` Stephen Leake
-- strict thread matches above, loose matches on Subject: below --
2000-01-20 0:00 Pascal LEJEUNE
2000-01-20 0:00 ` Hyman Rosen
2000-01-20 0:00 ` David Starner
2000-01-20 0:00 ` Stephen Leake
2000-01-22 0:00 ` Andy
2000-01-22 0:00 ` Matthew Heaney
2000-01-24 0:00 ` Stephen Leake
2000-01-22 0:00 ` Matthew Heaney
2000-01-24 0:00 ` Mats Weber
2000-01-24 0:00 ` Stephen Leake
2000-01-25 0:00 ` Matthew Heaney
2000-01-27 0:00 ` Stephen Leake
2000-01-20 0:00 ` Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox