Skip to content

Commit 1f91d49

Browse files
committed
8338197: ubsan: ad_x86.hpp:6417:11: runtime error: shift exponent 100 is too large for 32-bit type 'unsigned int'
1 parent cf70cb7 commit 1f91d49

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/hotspot/share/adlc/output_h.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,8 @@ void ArchDesc::declare_pipe_classes(FILE *fp_hpp) {
770770
fprintf(fp_hpp, " return ((_mask & in2._mask) != 0);\n");
771771
fprintf(fp_hpp, " }\n\n");
772772
fprintf(fp_hpp, " Pipeline_Use_Cycle_Mask& operator<<=(int n) {\n");
773-
fprintf(fp_hpp, " _mask <<= n;\n");
773+
fprintf(fp_hpp, " int max_shift = 8 * sizeof(n) - 1;\n");
774+
fprintf(fp_hpp, " _mask <<= (n < max_shift) ? n : max_shift;\n");
774775
fprintf(fp_hpp, " return *this;\n");
775776
fprintf(fp_hpp, " }\n\n");
776777
fprintf(fp_hpp, " void Or(const Pipeline_Use_Cycle_Mask &in2) {\n");
@@ -870,8 +871,7 @@ void ArchDesc::declare_pipe_classes(FILE *fp_hpp) {
870871
fprintf(fp_hpp, " }\n\n");
871872
fprintf(fp_hpp, " void step(uint cycles) {\n");
872873
fprintf(fp_hpp, " _used = 0;\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");
874+
fprintf(fp_hpp, " _mask <<= cycles;\n");
875875
fprintf(fp_hpp, " }\n\n");
876876
fprintf(fp_hpp, " friend class Pipeline_Use;\n");
877877
fprintf(fp_hpp, "};\n\n");

0 commit comments

Comments
 (0)