From: Jacob Lifshay Date: Tue, 26 Apr 2022 06:16:55 +0000 (-0700) Subject: fix UB caused by lkcl in 1afca349cc91beebe7fd04260e0f9e9dbf85eb06 X-Git-Tag: opf_rfc_ls005_v1~2587 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=60166adec55dc15fed77ccfcd5dad5fda22df6af;p=libreriscv.git fix UB caused by lkcl in 1afca349cc91beebe7fd04260e0f9e9dbf85eb06 --- diff --git a/openpower/sv/biginteger/divmnu64.c b/openpower/sv/biginteger/divmnu64.c index 8783f8d1a..0d3f3973a 100644 --- a/openpower/sv/biginteger/divmnu64.c +++ b/openpower/sv/biginteger/divmnu64.c @@ -98,7 +98,7 @@ int divmnu(unsigned q[], unsigned r[], const unsigned u[], const unsigned v[], k = 0; // the case of a for (j = m - 1; j >= 0; j--) { // single-digit - uint64_t dig2 = (k << 32) | u[j]; + uint64_t dig2 = ((uint64_t)k << 32) | u[j]; q[j] = dig2 / v[0]; // divisor here. k = dig2 % v[0]; // modulo back into next loop }