comp.lang.ada
 help / color / mirror / Atom feed
From: linnig@skvax1.csc.ti.COM
Subject: Optimizing out elaborations
Date: 14 Oct 88 13:33:33 GMT	[thread overview]
Message-ID: <8810141348.AA22416@ti.com> (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

                 reply	other threads:[~1988-10-14 13:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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