Skip to contentSkip to conversation

target-i386/helper.c: some constants can get truncated on 32bit

Qemu-devel Jindrich Makovicka 1 participant 1 message Jul 1, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

with

./configure --target-list=x86_64-softmmu

32-bit gcc produces warnings about a few constants with an L suffix:

/home/henry/build/qemu/trunk/target-i386/helper.c: In function ‘cpu_x86_handle_mmu_fault’: /home/henry/build/qemu/trunk/target-i386/helper.c:903:
warning: integer constant is too large for ‘long’
type /home/henry/build/qemu/trunk/target-i386/helper.c:933: warning:
integer constant is too large for ‘long’
type /home/henry/build/qemu/trunk/target-i386/helper.c:969: warning:
integer constant is too large for ‘long’
type /home/henry/build/qemu/trunk/target-i386/helper.c:977: warning:
integer constant is too large for ‘long’
type /home/henry/build/qemu/trunk/target-i386/helper.c:1012: warning:
integer constant is too large for ‘long’ type

These should be probably defined as long long to avoid truncation:

helper.c renamed from helper.c.orig +2 -2
@@ -822,9 +822,9 @@
 #define PHYS_ADDR_MASK 0xfffff000L
 #else
 # if defined(TARGET_X86_64)
-# define PHYS_ADDR_MASK 0xfffffff000L
+# define PHYS_ADDR_MASK 0xfffffff000LL
 # else
-# define PHYS_ADDR_MASK 0xffffff000L
+# define PHYS_ADDR_MASK 0xffffff000LL
 # endif
 #endif
 

Regards,

Signature · 1 line
Jindrich Makovicka