QFreeList: replace a Q_ASSERT(false) with Q_UNREACHABLE()
Q_ASSERT goes away in release builds, Q_UNREACHABLE() does not.
This also solves the GCC 12 warning about out-of-bounds access in QAbstractEventDispatcherPrivate::allocateTimerId():
In member function ‘_PTp* std::__atomic_base<_PTp>::load(std::memory_order) const [with _PTp = QFreeListElement]’, inlined from ‘_Tp std::atomic<_Tp>::load(std::memory_order) const [with _Tp = QFreeListElement]’ at atomic:579:25, inlined from ‘static T QAtomicOps::loadAcquire(const std::atomic&) [with T = QFreeListElement; X = QFreeListElement*]’ at thread/qatomic_cxx11.h:249:29, inlined from ‘X* QBasicAtomicPointer::loadAcquire() const [with X = QFreeListElement]’ at thread/qbasicatomic.h:233:64, inlined from ‘int QFreeList<T, ConstantsType>::next() [with T = void; ConstantsType = QtTimerIdFreeListConstants]’ at qfreelist_p.h:245:34, inlined from ‘static int QAbstractEventDispatcherPrivate::allocateTimerId()’ at kernel/qabstracteventdispatcher.cpp:99:24: bits/atomic_base.h:820:31: warning: ‘long unsigned int __atomic_load_8(const volatile void*, int)’ writing 8 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=] 820 | return __atomic_load_n(&_M_p, int(__m)); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ In file included from qglobalstatic.h:1, from qglobal.h:1395: qglobalstatic.h: In static member function ‘static int QAbstractEventDispatcherPrivate::allocateTimerId()’: qglobalstatic.h:127:23: note: at offset -8 into destination object ‘holder’ of size 56 127 | static Holder holder; | ^~~~~~
Pick-to: 5.15 6.2 6.3 Change-Id: I74249c52dc02478ba93cfffd16d232b275d5d216 Reviewed-by: Marc Mutz marc.mutz@qt.io (cherry picked from commit dcdb8884)