Standard C enums are 'int'-typed. On x86-64, GCC complains about defining
REG_UNASSIGNED as equal to ~0UL, because sizeof(unsigned long) >
sizeof(int) and the resulting value exceeds the allowed range. The actual
error is:

error: specified mode too small for enumeral values

Signed-off-by: Eduard - Gabriel Munteanu <[email protected]>
---
 arch/x86/include/arch/registers_32.h |    3 ++-
 arch/x86/include/arch/registers_64.h |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/arch/registers_32.h 
b/arch/x86/include/arch/registers_32.h
index 568fd90..c1a55e0 100644
--- a/arch/x86/include/arch/registers_32.h
+++ b/arch/x86/include/arch/registers_32.h
@@ -1,6 +1,7 @@
 #ifndef __X86_REGISTERS_32_H
 #define __X86_REGISTERS_32_H
 
+#include <limits.h>
 #include <stdbool.h>
 #include <assert.h>
 
@@ -28,7 +29,7 @@ enum machine_reg {
        REG_XBP = REG_EBP,
        REG_XSP,
 
-       REG_UNASSIGNED = ~0UL,
+       REG_UNASSIGNED = INT_MAX,
 };
 
 const char *reg_name(enum machine_reg reg);
diff --git a/arch/x86/include/arch/registers_64.h 
b/arch/x86/include/arch/registers_64.h
index 01545fa..b89bdff 100644
--- a/arch/x86/include/arch/registers_64.h
+++ b/arch/x86/include/arch/registers_64.h
@@ -1,6 +1,7 @@
 #ifndef __X86_REGISTERS_64_H
 #define __X86_REGISTERS_64_H
 
+#include <limits.h>
 #include <stdbool.h>
 
 enum machine_reg {
@@ -25,7 +26,7 @@ enum machine_reg {
        REG_RSP = NR_REGISTERS, /* R4 */
        REG_RBP, /* R5 */
 
-       REG_UNASSIGNED = ~0UL,
+       REG_UNASSIGNED = INT_MAX,
 
        /* Aliases that aid the reuse of code from x86-32. */
        REG_EAX = REG_RAX,
-- 
1.6.0.6


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to