RFR: 8338197: ubsan: ad_x86.hpp:6417:11: runtime error: shift exponent 100 is too large for 32-bit type 'unsigned int' [v2]
Vladimir Kozlov
kvn at openjdk.org
Fri Aug 22 22:33:51 UTC 2025
On Fri, 22 Aug 2025 19:15:08 GMT, Boris Ulasevich <bulasevich at openjdk.org> wrote:
>> src/hotspot/share/adlc/output_h.cpp line 774:
>>
>>> 772: fprintf(fp_hpp, " Pipeline_Use_Cycle_Mask& operator<<=(int n) {\n");
>>> 773: fprintf(fp_hpp, " int max_shift = 8 * sizeof(_mask) - 1;\n");
>>> 774: fprintf(fp_hpp, " _mask <<= (n < max_shift) ? n : max_shift;\n");
>>
>> sizeof(_mask) is know - it is sizeof(uint).
>> Lines 760-768 should be cleaned: ` <= 32` checks are redundant because of check at line 758. This is leftover from SPARC code (not clean) removal.
>
> Good point - I removed the redundant code.
>
> As for `sizeof(_mask)`, shouldn’t it just be `max_shift = 31` or `_mask <<= (n < 32) ? n : 31;`?
Yes, if `sizeof(uint)` is 32 bits on all our platforms.
Hmm, may be we should use `uint32_t` for `_mask` here. Then we can use 32 and 31 without confusion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26890#discussion_r2294867624
More information about the hotspot-compiler-dev
mailing list