sim: sh: fix conversion of PC to an integer

On LLP64 targets where sizeof(long) != sizeof(void*), this code fails:
sim/sh/interp.c:704:24: error: cast from pointer to integer of different size  -Werror=pointer-to-int-cast]
  704 |   do { memstalls += ((((long) PC & 3) != 0) ? (n) : ((n) - 1)); } while (0)
      |                        ^

Since this code simply needs to check alignment, cast it using uintptr_t
which is the right type for this.
This commit is contained in:
Mike Frysinger
2021-11-06 21:09:08 -04:00
parent a11cd3ddb2
commit 81817dacd6

View File

@@ -701,7 +701,7 @@ do { \
#else
#define MA(n) \
do { memstalls += ((((long) PC & 3) != 0) ? (n) : ((n) - 1)); } while (0)
do { memstalls += ((((uintptr_t) PC & 3) != 0) ? (n) : ((n) - 1)); } while (0)
#define L(x) thislock = x;
#define TL(x) if ((x) == prevlock) stalls++;