comp.lang.ada
 help / color / mirror / Atom feed
* Optimizing out elaborations
@ 1988-10-14 13:33 linnig
  0 siblings, 0 replies; only message in thread
From: linnig @ 1988-10-14 13:33 UTC (permalink / raw)



 Fred Hosch <fred@cs.utexas.EDU> writes:

> It's not clear to me that LRM 11.6(7) permits the compiler to optimize
> away the declaration elaboration.  If K were a variable subsequently
> assigned, the "predefined operation" of assignment "need not be invoked."
> I think a CONSTRAINT_ERROR or NUMERIC_ERROR is required to be raised
> in this case?

Imagine the following program segment:
        
	count: integer := 0;
	function counter return integer;

	a: constant integer := counter;
	b: constant integer := counter;	
	c: constant integer := counter;
	
	function counter return integer is
	begin count := count +1;
	  return count;
	end;
	...

I sure would expect A and C to get 1 and 3 respectively; even if the
compiler optimized away the variable B.

	Mike Linnig,
	Texas Instruments

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1988-10-14 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1988-10-14 13:33 Optimizing out elaborations linnig

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