> > On C structures, for attributes like "const", it is enough to > > consider that each field inherit the attribute of the structure. > > But for the volatile attribute, is it valid to treat each field as > > volatile like GCC does it now? > > "An object that has volatile-qualified type may be > modified in ways unknown to the implementation or > have other unknown side effects. Therefore any > expression referring to such an object shall be > evaluated strictly according to the rules of the abstract > machine, as described in 5.1.2.3." > > So, any reference to the object must treat the object as > volatile, and that includes any reference to any part of > the object.
If I correctly understand you, GCC is wrong reading a byte when the byte is part of a volatile structure - GCC needs to read the complete structure first, and then extract the byte. Shall I create another entry in Bugzilla, or the 3rd comment of GCC Bugzilla Bug 37135 is sufficient? http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37135 Etienne.