Skip to content

Commit

Permalink
Crash on WebCore::FrameLoader::effectiveReferrerPolicy() after 274396…
Browse files Browse the repository at this point in the history
…@main on ARM64 with GCC -O3

https://bugs.webkit.org/show_bug.cgi?id=273703

Reviewed by Michael Catanzaro.

This workarounds a bug on GCC (affecting at least GCC 12, 13, 14, 15-nightly)
where the compiler produces wrong code on ARM64 at certain optimization levels
(like -O3) which seems related to lambdas and variants.

This wrong code later leads to a crash when the browser starts at
WebCore::FrameLoader::effectiveReferrerPolicy()

* Source/WebCore/page/Page.cpp:
(WebCore::createMainFrame):

Canonical link: https://commits.webkit.org/279066@main
  • Loading branch information
clopez committed May 21, 2024
1 parent 00575a1 commit bc88915
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Source/WebCore/page/Page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,14 @@ static constexpr OptionSet<ActivityState> pageInitialActivityState()
return { ActivityState::IsVisible, ActivityState::IsInWindow };
}

static Ref<Frame> createMainFrame(Page& page, PageConfiguration::ClientCreatorForMainFrame&& clientCreator, RefPtr<Frame> mainFrameOpener, FrameIdentifier identifier)
// FIXME: workaround for GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115135
#if COMPILER(GCC) && CPU(ARM64)
#define GCC_MAYBE_NO_INLINE NEVER_INLINE
#else
#define GCC_MAYBE_NO_INLINE
#endif

GCC_MAYBE_NO_INLINE static Ref<Frame> createMainFrame(Page& page, PageConfiguration::ClientCreatorForMainFrame&& clientCreator, RefPtr<Frame> mainFrameOpener, FrameIdentifier identifier)
{
page.relaxAdoptionRequirement();
return switchOn(WTFMove(clientCreator), [&] (CompletionHandler<UniqueRef<LocalFrameLoaderClient>(LocalFrame&)>&& localFrameClientCreator) -> Ref<Frame> {
Expand Down

0 comments on commit bc88915

Please sign in to comment.