Skip to content

Commit c45ca06

Browse files
adrien-zingernhorman
authored andcommitted
Fix GCC compilation -Waggressive-loop-optimizations
GCC 13.1.0 were reporting a compilation warning with -O2/3 and -Waggressive-loop-optimizations. GCC is raising an undefined behavior in the while loop. Replace the while loop with a memset call at the top of the function. Fixes openssl#21088 CLA: trivial Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Bernd Edlinger <[email protected]> Reviewed-by: Neil Horman <[email protected]> (Merged from openssl#23898)
1 parent 5673680 commit c45ca06

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Diff for: crypto/bn/rsaz_exp_x2.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -576,11 +576,7 @@ static void to_words52(BN_ULONG *out, int out_len,
576576
out_len--;
577577
}
578578

579-
while (out_len > 0) {
580-
*out = 0;
581-
out_len--;
582-
out++;
583-
}
579+
memset(out, 0, out_len * sizeof(BN_ULONG));
584580
}
585581

586582
static ossl_inline void put_digit(uint8_t *out, int out_len, uint64_t digit)

0 commit comments

Comments
 (0)