From 828d48d077159fb9e1e6ca0c3453f847a24051e1 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 16 Feb 2018 16:34:39 -0500 Subject: [PATCH] target-i386: Use 1UL for bit shift Fix undefined behavior detected by clang runtime check: qemu/target-i386/cpu.c:1494:15: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' While doing that, add extra parenthesis for clarity. Backports commit 72370dc1149d7c90d2c2218e0d0658bee23a5bf7 from qemu --- qemu/target-i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu/target-i386/cpu.c b/qemu/target-i386/cpu.c index 5a937f81..9cff1e96 100644 --- a/qemu/target-i386/cpu.c +++ b/qemu/target-i386/cpu.c @@ -1447,7 +1447,7 @@ static void report_unavailable_features(FeatureWord w, uint32_t mask) int i; for (i = 0; i < 32; ++i) { - if (1 << i & mask) { + if ((1UL << i) & mask) { const char *reg = get_register_name_32(f->cpuid_reg); assert(reg); fprintf(stderr, "warning: %s doesn't support requested feature: "