Skip to content

Commit c19f86d

Browse files
author
SendaoYan
committed
8332368: ubsan aarch64: immediate_aarch64.cpp:298:31: runtime error: shift exponent 32 is too large for 32-bit type 'int'
Backport-of: d783a940988677dc91975f884adeaf9f047f7e07
1 parent 20ff119 commit c19f86d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/hotspot/share/adlc/output_h.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,8 @@ void ArchDesc::declare_pipe_classes(FILE *fp_hpp) {
856856
fprintf(fp_hpp, " }\n\n");
857857
fprintf(fp_hpp, " void step(uint cycles) {\n");
858858
fprintf(fp_hpp, " _used = 0;\n");
859-
fprintf(fp_hpp, " _mask <<= cycles;\n");
859+
fprintf(fp_hpp, " uint max_shift = 8 * sizeof(_mask) - 1;\n");
860+
fprintf(fp_hpp, " _mask <<= (cycles < max_shift) ? cycles : max_shift;\n");
860861
fprintf(fp_hpp, " }\n\n");
861862
fprintf(fp_hpp, " friend class Pipeline_Use;\n");
862863
fprintf(fp_hpp, "};\n\n");

0 commit comments

Comments
 (0)