[PATCH] C undefined behavior fix
Horst von Brand
brand@tigger.cs.uni-dortmund.de
Fri Jan 11 04:09:00 GMT 2002
Bernard Dautrevaux <Dautrevaux@microprocess.com> said:
[...]
> So at least for the first test, gcc-3.1 generates the same (anoying) code as
> 2.95.3. I'm quite sure this is legal, as I can't see in the standard if when
> writing:
>
> volatile unsigned int x:8;
>
> I define:
> 1) a volatile 8-bit field to be interpreted as an unsigned int.
> 2) an 8-bit field which is part of a volatile unsigned int.
If the whole is volatile (x must be inside a struct) make that volatile.
Sounds quite natural to me...
--
Horst von Brand http://counter.li.org # 22616
More information about the Gcc
mailing list