From 5418c8764f3d1b30a72951b29beaa9cf408d1ee9 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 27 Oct 2017 10:46:00 +0200 Subject: 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 --- src/corelib/thread/qsemaphore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib/thread') 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 *futexLow32(QBasicAtomicInteger *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(Q_UINT64_C(1) << 63); static QBasicAtomicInteger *futexHigh32(QBasicAtomicInteger *ptr) { auto result = reinterpret_cast *>(ptr); -- cgit v1.2.3