[LLVMbugs] [Bug 14694] New: clang violates C++11 memory model for bitfields at end of structs

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 21 15:39:30 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14694

             Bug #: 14694
           Summary: clang violates C++11 memory model for bitfields at end
                    of structs
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Consider this:

union U {
  struct { int c : 23; };
  struct { int c2 : 23; char k; };
} s;
void f() { s.c = 5; }

Per the C++11 memory model and common initial sequence rules, 'f' is only
permitted to write to the first three bytes of s. Clang emits an i32 load and
an i32 store, which can introduce a data race on 's.k'.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list