Skip to content
Snippets Groups Projects
  • Tim Northover's avatar
    6a3c4de2
    Atomics: support __c11_* calls on _Atomic struct types. · 6a3c4de2
    Tim Northover authored
    When a struct's size is not a power of 2, the corresponding _Atomic() type is
    promoted to the nearest. We already correctly handled normal C++ expressions of
    this form, but direct calls to the __c11_atomic_whatever builtins ended up
    performing dodgy operations on the smaller non-atomic types (e.g. memcpy too
    much). Later optimisations removed this as undefined behaviour.
    
    This patch converts EmitAtomicExpr to allocate its temporaries at the full
    atomic width, sidestepping the issue.
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252507 91177308-0d34-0410-b5e6-96231b3b80d8
    6a3c4de2
    History
    Atomics: support __c11_* calls on _Atomic struct types.
    Tim Northover authored
    When a struct's size is not a power of 2, the corresponding _Atomic() type is
    promoted to the nearest. We already correctly handled normal C++ expressions of
    this form, but direct calls to the __c11_atomic_whatever builtins ended up
    performing dodgy operations on the smaller non-atomic types (e.g. memcpy too
    much). Later optimisations removed this as undefined behaviour.
    
    This patch converts EmitAtomicExpr to allocate its temporaries at the full
    atomic width, sidestepping the issue.
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252507 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.