Re: [PATCH] C undefined behavior fix

Horst von Brand
2002-01-11T09:52:45Z

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