This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-fstrict-volatile-bitfields fixes


The patch below fixes two problems with -fstrict-volatile-bitfields.

As the ARM testcase shows, writing to an 8-bit bitfield at source level
can cause the compiler to emit a plain 32-bit store, rather than a
read-modify-write operation. This is fixed by the patch in expr.c,
detecting when the mode we want to use for the access is larger than the
bit field.

The other problem is that the option only has an effect on bitfields
declared as volatile. However, when an object is cast to volatile, it
has no effect. We have a customer who thinks that is undesirable, and I
agree. This is fixed in stor-layout.c.

The second fix caused a failure in g++/abi/bitfield12.C, where a warning
message is missing, since the C++ frontend apparently expects to see a
different mode. I discussed this with Mark, and the end result was to
disallow the combination of -fabi-version=1 and
-fstrict-volatile-bitfields. This makes sense in that when an old ABI
version is explicitly selected, we should really try not to change
behaviour.

Bootstrapped and regression tested on i686-linux. Also tested in an
internal 4.5-based tree on arm-linux. Ok?


Bernd

Attachment: mainline-strv5.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]