[cxx-mem-model] test invalid bitfield twiddling

Aldy Hernandez aldyh@redhat.com
Mon Mar 21 16:56:00 GMT 2011


This test is inspired by PR 48124.

[Jakub, let me know if you find any additional variations on this theme.]

In the C++ memory model, non contiguous bitfields are distinct memory 
locations and cannot be accessed by and/or magic if we introduce data races.

In the test below, we can trigger invalid bit twiddling by declaring a 
bit field as volatile and then accessing it.  On x86-64, we end up using 
a 32-bit access which ends up touching the rest of the fields.

Unfortunately, I can't come up with a suitable test without the 
volatile-- I guess that's a good thing (either that, or my bit twiddle 
skills are lacking).

Committing to branch.

p.s. Oh yeah, I found some small buglets in the harness which are fixed 
below.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: curr
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110321/dc05d3d4/attachment.ksh>


More information about the Gcc-patches mailing list