diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-11-06 21:09:08 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-11-06 21:09:08 -0400 |
commit | 81817dacd6dd6f8204518ad50e0c8b534d6a4366 (patch) | |
tree | f847d7f68ba634a2d66a9ab948f9ae8e8d384855 | |
parent | a11cd3ddb2af90da3e5af9917a3cf1c749479983 (diff) | |
download | fsf-binutils-gdb-81817dacd6dd6f8204518ad50e0c8b534d6a4366.zip fsf-binutils-gdb-81817dacd6dd6f8204518ad50e0c8b534d6a4366.tar.gz fsf-binutils-gdb-81817dacd6dd6f8204518ad50e0c8b534d6a4366.tar.bz2 |
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.
-rw-r--r-- | sim/sh/interp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sim/sh/interp.c b/sim/sh/interp.c index c502b21..93923fa 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -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++; |