summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2015-09-29 17:34:22 -0300
committerEduardo Habkost <ehabkost@redhat.com>2015-10-23 13:07:27 -0200
commit72370dc1149d7c90d2c2218e0d0658bee23a5bf7 (patch)
tree6a0d63aca021845905d644615226f729f3dafb69
parentb6c5a6f021f485fc36bca678b2c867e9b6783924 (diff)
downloadfocaccia-qemu-72370dc1149d7c90d2c2218e0d0658bee23a5bf7.tar.gz
focaccia-qemu-72370dc1149d7c90d2c2218e0d0658bee23a5bf7.zip
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.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
-rw-r--r--target-i386/cpu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index c92dd066fc..c1a9e09743 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1491,7 +1491,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: "