Skip to content

Assertion failed: !(isAtomic() && getAlignment() == 0) && "Alignment required for atomic load" #44355

@llvmbot

Description

@llvmbot
Bugzilla Link 45010
Resolution FIXED
Resolved on Feb 28, 2020 02:35
Version 10.0
OS Windows NT
Blocks #43900
Reporter LLVM Bugzilla Contributor
CC @chandlerc,@zmodem,@jfbastien,@zygoloid

Extended Description

When compiling Clang with assertions enabled, I'm seeing the assert I've mentioned here: https://reviews.llvm.org/D71547#1824272

Repro:

// a.cpp
// Build with: clang-cl a.cpp /c /O1
#include
struct SP {
void WeakAddRef();
void WeakRelease();
};
template struct PtrBase {
T *volatile P;
~PtrBase() {
if (R)
R->WeakRelease();
}
PtrBase(const PtrBase &O) : R(O.R) {
if (R)
R->WeakAddRef();
}
SP *R;
bool IsValid() const { return P != nullptr; }
};
struct alignas(16) VectorSIMD4f {
float V;
};
unsigned __int64 countAF() {
class AF {
VectorSIMD4f B;
};
struct PD {
PtrBase P;
};
std::vector AFs;
unsigned __int64 C = 0;
for (auto A : AFs) {
if (A.P.IsValid())
++C;
}
return C;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions