Skip to content

Commit 7cdeffa

Browse files
committed
[libc] Suppress GCC loop optimization warning
Summary: This appears to be a false positive on some versions of GCC.
1 parent 3757ecf commit 7cdeffa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

libc/src/__support/big_int.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,11 +790,21 @@ struct BigInt {
790790
remainder[pos] = rem;
791791
}
792792

793+
// GCC currently emits a false-positive warning on this for some compilers.
794+
#ifdef __GNUC__
795+
#pragma GCC diagnostic push
796+
#pragma GCC diagnostic ignored "-Waggressive-loop-optimizations"
797+
#endif
798+
793799
// Set the remaining lower bits of the remainder.
794800
for (; pos > 0; --pos) {
795801
remainder[pos - 1] = val[pos - 1];
796802
}
797803

804+
#ifdef __GNUC__
805+
#pragma GCC diagnostic pop
806+
#endif
807+
798808
*this = quotient;
799809
return remainder;
800810
}
@@ -851,8 +861,8 @@ struct BigInt {
851861
result[i] = lhs[i] OP rhs[i]; \
852862
return result; \
853863
} \
854-
LIBC_INLINE friend constexpr BigInt operator OP##=(BigInt &lhs, \
855-
const BigInt &rhs) { \
864+
LIBC_INLINE friend constexpr BigInt operator OP## = \
865+
(BigInt & lhs, const BigInt &rhs) { \
856866
for (size_t i = 0; i < WORD_COUNT; ++i) \
857867
lhs[i] OP## = rhs[i]; \
858868
return lhs; \

0 commit comments

Comments
 (0)