Skip to content

Commit 541f772

Browse files
authored
Merge pull request #42130 from compnerd/underaligned
runtime: identify potential miscompiles
2 parents 99ba715 + 6343aee commit 541f772

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/swift/Runtime/AtomicWaitQueue.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ class AtomicWaitQueue {
424424
private:
425425
template <class... Args>
426426
static Impl *createNewQueue(Args &&...args) {
427+
#if !defined(__cpp_aligned_new)
428+
static_assert(std::alignment_of<Impl>::value <= __STDCPP_DEFAULT_NEW_ALIGNMENT__,
429+
"type is over-aligned for non-alignment aware operator new");
430+
#endif
427431
auto queue = new Impl(std::forward<Args>(args)...);
428432
queue->WaitQueueLock.lock();
429433
return queue;

0 commit comments

Comments
 (0)