*devaddr = 0 and volatile

Henry Spencer henry at utzoo.uucp
Wed Dec 7 04:06:14 AEST 1988


In article <23706 at amdcad.AMD.COM> tim at crackle.amd.com (Tim Olson) writes:
>...the problem of unaligned accesses through a pointer to a volatile object
>which is larger than a char, but is not properly aligned...
>  What should be done here?

"Bus error -- core dumped."  :-)

More seriously, it's really not entirely clear just how strong a guarantee
of atomicity you get from X3J11's words about volatile.  I doubt that the
rules are intended to forbid pdp11 floating point, which necessarily uses
multiple accesses per object because no pdp11 has a 64-bit memory bus.
I think you have to consider volatile as meaning "no surprises" -- is
it really a surprise that a large unaligned object requires more than one
access?
-- 
SunOSish, adj:  requiring      |     Henry Spencer at U of Toronto Zoology
32-bit bug numbers.            | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list