comp.lang.ada
 help / color / mirror / Atom feed
From: claveman@fern.com (Charles H. Sampson)
Subject: Re: Handling Addressing Errors
Date: 1999/03/18
Date: 1999-03-18T00:00:00+00:00	[thread overview]
Message-ID: <1999Mar18.005620.19189@nosc.mil> (raw)
In-Reply-To: 7bm0v3$933$1@nnrp1.dejanews.com

In article <7bm0v3$933$1@nnrp1.dejanews.com>,
 <robert_dewar@my-dejanews.com> wrote:
>In article <1999Mar3.212443.1898@nosc.mil>,
>  claveman@cod.nosc.mil (me) wrote:
>
>>            ... what prevents an optimizing compiler from
>> deciding that the assignment statement is unnecessary
>> (BOGUS is never referenced after being set) so that it
>> doesn't need to access BOARD_LOCATION?
>
>Common sense and reasonable behavior!

     In short, there's not much hope.  :-)

     Seriously, while it's hard to argue against common sense and rea-
sonable behavior, I wish the LRM had explicitly said what should happen.

>Any compiler that does not use an address clause to trigger
>an implicit volatility is poorly designed in my view. Of
>course it does not harm to put in a specific pragma
>Volatile, and that will most certainly solve this problem

     Fair enough that an address clause should implicitly trigger vola-
tility, but that's not quite the issue.  Suppose the address clause had 
caused an overlay of two objects (rather than creating an access to a 
slave board location, as in my original example).  Then any reasonable 
compiler--any correct compiler--must access memory any time the value of 
one of the objects is needed, to prevent using a stale value held else-
where.  But in my example, dead store elimination would determine that 
storing BOGUS is not necessary.  It's only a small jump from that to 
determining that the value of BOARD_VALUE isn't needed, so there's no 
point in fetching it.

     By my reading, even pragma Volatile doesn't help, because C.6(10) 
only says that all reads are performed directly to memory.  It doesn't 
say that the read must be performed even if it is known that the value 
is not used.  I think it's well beyond the LRM to say that a read of a 
volatile object might have some effect in addition to obtaining its 
value and, therefore, all reads must be performed whether the value is 
needed or not.

				Charlie
--
******

     For an email response, my user name is "sampson" and my host
is "spawar.navy.mil".




  reply	other threads:[~1999-03-18  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-03  0:00 Handling Addressing Errors Charles H. Sampson
1999-03-04  0:00 ` Nick Roberts
1999-03-04  0:00 ` robert_dewar
1999-03-18  0:00   ` Charles H. Sampson [this message]
1999-03-18  0:00     ` Nick Roberts
1999-03-21  0:00       ` robert_dewar
1999-03-18  0:00     ` Tucker Taft
1999-03-19  0:00       ` Mikko Levanto
1999-03-19  0:00         ` Nick Roberts
1999-03-20  0:00         ` Tucker Taft
1999-04-02  0:00       ` Charles H. Sampson
1999-03-19  0:00     ` robert_dewar
replies disabled

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