From: kenner@lab.ultra.nyu.edu (Richard Kenner)
Subject: Re: Not intended for use in medical devices
Date: 1997/05/14
Date: 1997-05-14T00:00:00+00:00 [thread overview]
Message-ID: <5lc1rb$jb7$1@news.nyu.edu> (raw)
In-Reply-To: dewar.863254614@merv
In article <dewar.863254614@merv> dewar@merv.cs.nyu.edu (Robert Dewar) writes:
> type xt is mod 2**8;
> x : xt;
> for x'address use ...
> pragma Atomic (x);
> for x'size use 8;
>
>and after that mouthful, we write:
>
> if (x and 2#0100#) then ..
An even more subtle example with that same declaration is writing
x := 0;
On a PDP-11, this will normally generate a "CLR" instruction, which
sets a location to zero. But on most PDP-11 models, CLR first reads
the location, then sets it to zero (because all of the other
one-operand instructions read the location, so the hardware designers
took a shortcut). If reading and writing to a memory-mapped I/O
location means very different things (relatively common, especially
back in those days), this can have very unexpected results.
(This is not hypothetical; I often made the mistake of using CLR in
assembler code when I needed to use a MOV instruction to zero some
mapped location.)
Of course, an Ada (and C!) compiler for the PDP-11 should probably
avoid using CLR on volatile memory for just this reason.
next prev parent reply other threads:[~1997-05-14 0:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-05-04 0:00 Not intended for use in medical devices Robert C. Leif, Ph.D.
1997-05-05 0:00 ` Kaz Kylheku
1997-05-06 0:00 ` Robert Dewar
1997-05-06 0:00 ` Kaz Kylheku
1997-05-12 0:00 ` Ken Garlington
1997-05-06 0:00 ` Michael F Brenner
1997-05-06 0:00 ` Kaz Kylheku
1997-05-07 0:00 ` Robert Dewar
1997-05-08 0:00 ` Matthew Heaney
1997-05-10 0:00 ` Robert Dewar
1997-05-14 0:00 ` Richard Kenner [this message]
-- strict thread matches above, loose matches on Subject: below --
1997-05-03 0:00 Robert C. Leif, Ph.D.
1997-05-03 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