Skip to content

Commit

Permalink
Fix OOM crash when doing arm64 builds with old gcc-10
Browse files Browse the repository at this point in the history
Gcc compiler crashes when trying optimize if statement
with 3 boolean due to compiler bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109505

However issue was only fixed in gcc-11 and above,
unfortunately we run gcc-10 on ci.

Note it happens for us only with 64 bit arm gcc,
however issue is most likely also present without cross
compiling with 64-bit gcc-10.

Avoid optimization in that specific case.

Task-number: QTBUG-123822
Change-Id: I660e759fad8d01b4aa5f9b02095d79a18f06ade2
Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/553656
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
  • Loading branch information
Michal Klocek committed Apr 9, 2024
1 parent 67e4d62 commit c489ea4
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,16 @@ absl::Status EvaluateSeedsHwy(

// Check if inputs and outputs are aligned.
constexpr size_t kHwyAlignment = alignof(Aligned128);

#if defined(__GNUC__) && defined(__GNUC_MINOR__) && ((__GNUC__ << 16) + __GNUC_MINOR__ <= (11 << 16) + 4)
// Gcc Bug 109505
// Try to avoid triggering endless loop in gcc and OOM
// and try to avoid optimize conditional booleans in
// ABSL_PREDICT_FALSE(!is_aligned || hn::Lanes(d8) < 16 || hn::Lanes(d8) % 16 != 0))
volatile bool is_aligned =
#else
const bool is_aligned =
#endif
(reinterpret_cast<uintptr_t>(seeds_in) % kHwyAlignment == 0) &&
(reinterpret_cast<uintptr_t>(paths) % kHwyAlignment == 0) &&
(reinterpret_cast<uintptr_t>(correction_seeds) % kHwyAlignment == 0) &&
Expand Down

0 comments on commit c489ea4

Please sign in to comment.