Skip to content

Commit

Permalink
more gcc workarounds
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad0 committed Feb 21, 2024
1 parent 72c33b0 commit c45bf42
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
10 changes: 10 additions & 0 deletions barretenberg/cpp/src/barretenberg/common/ref_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,18 @@ template <typename T, std::size_t N> class RefArray {

T& operator[](std::size_t idx) const
{
// GCC has a bug where it has trouble analyzing zip_view
// this is likely due to this bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104165
// We disable this - if GCC was right, we would have caught this at runtime
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
ASSERT(idx < N);
return *storage[idx];
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,14 +576,6 @@ TYPED_TEST(ScalarMultiplicationTests, EndomorphismSplit)
Fr* k2_t = (Fr*)&scalar.data[2];

Fr::split_into_endomorphism_scalars(scalar, *k1_t, *k2_t);
// The compiler really doesn't like what we're doing here,
// and disabling the array-bounds error project-wide seems unsafe.
// The large macro blocks are here to warn that we should be careful when
// aliasing the arguments to split_into_endomorphism_scalars
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
Fr k1{ (*k1_t).data[0], (*k1_t).data[1], 0, 0 };
Fr k2{ (*k2_t).data[0], (*k2_t).data[1], 0, 0 };
#if !defined(__clang__) && defined(__GNUC__)
Expand Down
11 changes: 1 addition & 10 deletions barretenberg/cpp/src/barretenberg/sumcheck/sumcheck.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,10 @@ template <typename Flavor> class SumcheckVerifier {
auto transcript_evaluations =
transcript->template receive_from_prover<std::array<FF, NUM_POLYNOMIALS>>("Sumcheck:evaluations");

// GCC has a bug where it says this is above array bounds
// but this is likely due to this bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104165
// We disable this - if GCC was right, we would have caught this at runtime
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
for (auto [eval, transcript_eval] : zip_view(purported_evaluations.get_all(), transcript_evaluations)) {
eval = transcript_eval;
}
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

FF full_honk_relation_purported_value = round.compute_full_honk_relation_purported_value(
purported_evaluations, relation_parameters, pow_univariate, alpha);

Expand Down

0 comments on commit c45bf42

Please sign in to comment.