Skip to content

Commit d783a94

Browse files
author
Boris Ulasevich
committed
8332368: ubsan aarch64: immediate_aarch64.cpp:298:31: runtime error: shift exponent 32 is too large for 32-bit type 'int'
Reviewed-by: adinn
1 parent 6a31061 commit d783a94

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
@@ -870,7 +870,8 @@ void ArchDesc::declare_pipe_classes(FILE *fp_hpp) {
870870
fprintf(fp_hpp, " }\n\n");
871871
fprintf(fp_hpp, " void step(uint cycles) {\n");
872872
fprintf(fp_hpp, " _used = 0;\n");
873-
fprintf(fp_hpp, " _mask <<= cycles;\n");
873+
fprintf(fp_hpp, " uint max_shift = 8 * sizeof(_mask) - 1;\n");
874+
fprintf(fp_hpp, " _mask <<= (cycles < max_shift) ? cycles : max_shift;\n");
874875
fprintf(fp_hpp, " }\n\n");
875876
fprintf(fp_hpp, " friend class Pipeline_Use;\n");
876877
fprintf(fp_hpp, "};\n\n");

0 commit comments

Comments
 (0)