Received: from eggs.gnu.org ([2001:4830:134:3::10]:38091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCuL2-0003EW-4c for qemu-devel@nongnu.org; Fri, 23 Aug 2013 12:35:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCuKy-0008DQ-OX for qemu-devel@nongnu.org; Fri, 23 Aug 2013 12:35:52 -0400 Received: from 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:1d0::1]:59453 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCuKy-0008CX-Hb for qemu-devel@nongnu.org; Fri, 23 Aug 2013 12:35:48 -0400 From: Peter Maydell Date: Fri, 23 Aug 2013 17:35:45 +0100 Message-Id: <1377275745-8942-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH] block/qcow2.h: Avoid "1LL << 63" (shifts into sign bit) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , patches@linaro.org The expression "1LL << 63" tries to shift the 1 into the sign bit of a 'long long', which provokes a clang sanitizer warning: runtime error: left shift of 1 by 63 places cannot be represented in type 'long long' Use "1ULL << 63" as the definition of QCOW_OFLAG_COPIED instead to avoid this. For consistency, we also update the other QCOW_OFLAG definitions to use the ULL suffix rather than LL, though only the shift by 63 is undefined behaviour. Signed-off-by: Peter Maydell --- block/qcow2.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index dba9771..365a17e 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -40,11 +40,11 @@ #define QCOW_MAX_CRYPT_CLUSTERS 32 /* indicate that the refcount of the referenced cluster is exactly one. */ -#define QCOW_OFLAG_COPIED (1LL << 63) +#define QCOW_OFLAG_COPIED (1ULL << 63) /* indicate that the cluster is compressed (they never have the copied flag) */ -#define QCOW_OFLAG_COMPRESSED (1LL << 62) +#define QCOW_OFLAG_COMPRESSED (1ULL << 62) /* The cluster reads as all zeros */ -#define QCOW_OFLAG_ZERO (1LL << 0) +#define QCOW_OFLAG_ZERO (1ULL << 0) #define REFCOUNT_SHIFT 1 /* refcount size is 2 bytes */ -- 1.7.9.5