From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7a58195927ccb785 X-Google-Attributes: gid103376,public From: kenner@lab.ultra.nyu.edu (Richard Kenner) Subject: Re: Not intended for use in medical devices Date: 1997/05/14 Message-ID: <5lc1rb$jb7$1@news.nyu.edu>#1/1 X-Deja-AN: 241480254 References: Organization: New York University Ultracomputer Research Lab Newsgroups: comp.lang.ada Date: 1997-05-14T00:00:00+00:00 List-Id: In article 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.