path: root/src
diff options
authorUlf Hermann <>2017-10-27 10:46:00 +0200
committerLiang Qi <>2017-11-04 14:30:55 +0000
commit5418c8764f3d1b30a72951b29beaa9cf408d1ee9 (patch)
tree6de541fcf702d733e7d892fa6fe80b38fd742aa1 /src
parent365a41ce25d9e8300af64115ad2e4373478ce16b (diff)
QSemaphore: Fix futexMultiWaiterBit for 32bit systems
We don't actually need it in that case, but as the code that uses it is disabled by a constant expression we cannot disable the variable itself by a macro. The static_cast makes sure the compiler does not complain about implicitly casting a 64bit value to a 32bit one. thread/qsemaphore.cpp:156:59: error: large integer implicitly truncated to unsigned type [-Werror=overflow] Task-number: QTBUG-64261 Change-Id: I96f53e28b290e57033737b4f994f8af5b5666587 Reviewed-by: Liang Qi <>
Diffstat (limited to 'src')
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index 24f5769d05..21acc533a1 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -153,7 +153,8 @@ static QBasicAtomicInteger<quint32> *futexLow32(QBasicAtomicInteger<quintptr> *p
#ifdef FUTEX_OP
-static const quintptr futexMultiWaiterBit = Q_UINT64_C(1) << 63;
+// quintptr might be 32bit, in which case we want this to be 0, without implicitly casting.
+static const quintptr futexMultiWaiterBit = static_cast<quintptr>(Q_UINT64_C(1) << 63);
static QBasicAtomicInteger<quint32> *futexHigh32(QBasicAtomicInteger<quintptr> *ptr)
auto result = reinterpret_cast<QBasicAtomicInteger<quint32> *>(ptr);