forked from wolfSSL/wolfssl
sp_int.c:sp_set(): use PRAGMA_GCC_* macros, not ad hoc gated __Pragmas, to mask spurious -Warray-bounds.
This commit is contained in:
@@ -2902,26 +2902,18 @@ int sp_set(sp_int* a, sp_int_digit d)
|
|||||||
err = MP_VAL;
|
err = MP_VAL;
|
||||||
}
|
}
|
||||||
if (err == MP_OKAY) {
|
if (err == MP_OKAY) {
|
||||||
#if defined(__GNUC__)
|
/* gcc-11 reports out-of-bounds array access if the byte array backing
|
||||||
#if __GNUC__ == 11
|
* the sp_int* is smaller than sizeof(sp_int), as occurs when
|
||||||
/* gcc-11 falsely reports out-of-bounds array access if the byte array
|
|
||||||
* backing the sp_int* is smaller than sizeof(sp_int), as occurs when
|
|
||||||
* WOLFSSL_SP_SMALL.
|
* WOLFSSL_SP_SMALL.
|
||||||
*/
|
*/
|
||||||
_Pragma("GCC diagnostic push");
|
PRAGMA_GCC_DIAG_PUSH;
|
||||||
_Pragma("GCC diagnostic ignored \"-Warray-bounds\"");
|
PRAGMA_GCC("GCC diagnostic ignored \"-Warray-bounds\"");
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
a->dp[0] = d;
|
a->dp[0] = d;
|
||||||
a->used = d > 0;
|
a->used = d > 0;
|
||||||
#ifdef WOLFSSL_SP_INT_NEGATIVE
|
#ifdef WOLFSSL_SP_INT_NEGATIVE
|
||||||
a->sign = MP_ZPOS;
|
a->sign = MP_ZPOS;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__GNUC__)
|
PRAGMA_GCC_DIAG_POP;
|
||||||
#if __GNUC__ >= 11
|
|
||||||
_Pragma("GCC diagnostic pop");
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
Reference in New Issue
Block a user