Skip to content

Commit f5d6fdd

Browse files
author
Daniel D. Daugherty
committed
8280476: [macOS] : hotspot arm64 bug exposed by latest clang
Reviewed-by: kbarrett, adinn
1 parent d4b99bc commit f5d6fdd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/hotspot/cpu/aarch64/immediate_aarch64.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,17 @@ static inline uint32_t uimm(uint32_t val, int hi, int lo)
129129

130130
uint64_t replicate(uint64_t bits, int nbits, int count)
131131
{
132+
assert(count > 0, "must be");
133+
assert(nbits > 0, "must be");
134+
assert(count * nbits <= 64, "must be");
135+
136+
// Special case nbits == 64 since the shift below with that nbits value
137+
// would result in undefined behavior.
138+
if (nbits == 64) {
139+
return bits;
140+
}
141+
132142
uint64_t result = 0;
133-
// nbits may be 64 in which case we want mask to be -1
134143
uint64_t mask = ones(nbits);
135144
for (int i = 0; i < count ; i++) {
136145
result <<= nbits;

0 commit comments

Comments
 (0)