From d6f814d384d48f97944af97559fadfcf634744bf Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Fri, 29 Jun 2018 12:05:59 -0700 Subject: [PATCH] Fix issue with signed/unsigned comparison On Mac (maybe on other platforms using clang?) the following set of comparisons in the emitter were done as unsigned: ``` (val >= 0xFFFFFFFF80000000LL) ``` even though 'val' is signed. This led to assertion failures. On Windows, the comparisons were signed. To fix this, cast the constant to the signed `ssize_t` type (to match `val`). Fixes #18341 --- src/jit/emitxarch.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jit/emitxarch.cpp b/src/jit/emitxarch.cpp index 1211256..bbc086d 100644 --- a/src/jit/emitxarch.cpp +++ b/src/jit/emitxarch.cpp @@ -8292,7 +8292,7 @@ void emitter::emitDispIns( val = emitGetInsSC(id); #ifdef _TARGET_AMD64_ // no 8-byte immediates allowed here! - assert((val >= 0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); + assert((val >= (ssize_t)0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); #endif if (id->idIsCnsReloc()) { @@ -8492,7 +8492,7 @@ void emitter::emitDispIns( val = cnsVal.cnsVal; #ifdef _TARGET_AMD64_ // no 8-byte immediates allowed here! - assert((val >= 0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); + assert((val >= (ssize_t)0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); #endif if (id->idInsFmt() == IF_ARW_SHF) { @@ -8560,7 +8560,7 @@ void emitter::emitDispIns( val = cnsVal.cnsVal; #ifdef _TARGET_AMD64_ // no 8-byte immediates allowed here! - assert((val >= 0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); + assert((val >= (ssize_t)0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); #endif if (id->idInsFmt() == IF_SRW_SHF) { @@ -8760,7 +8760,7 @@ void emitter::emitDispIns( val = emitGetInsSC(id); #ifdef _TARGET_AMD64_ // no 8-byte immediates allowed here! - assert((val >= 0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); + assert((val >= (ssize_t)0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); #endif printf(", "); if (id->idIsCnsReloc()) @@ -8928,7 +8928,7 @@ void emitter::emitDispIns( val = cnsVal.cnsVal; #ifdef _TARGET_AMD64_ // no 8-byte immediates allowed here! - assert((val >= 0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); + assert((val >= (ssize_t)0xFFFFFFFF80000000LL) && (val <= 0x000000007FFFFFFFLL)); #endif if (cnsVal.cnsReloc) { -- 2.7.4