<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Crash on xLarge memory allocation using bmalloc on 32bit systems"
href="https://bugs.webkit.org/show_bug.cgi?id=146440#c11">Comment # 11</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Crash on xLarge memory allocation using bmalloc on 32bit systems"
href="https://bugs.webkit.org/show_bug.cgi?id=146440">bug 146440</a>
from <span class="vcard"><a class="email" href="mailto:mario@webkit.org" title="Mario Sanchez Prada <mario@webkit.org>"> <span class="fn">Mario Sanchez Prada</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=146440#c10">comment #10</a>)
<span class="quote">> (In reply to <a href="show_bug.cgi?id=146440#c6">comment #6</a>)
> > (In reply to <a href="show_bug.cgi?id=146440#c4">comment #4</a>)
> > > [...]
> > > What about setting this flag only for the bmalloc source files at
> > > Source/bmalloc/CMakeLists.txt . Would it be enough?
> >
> > Not sure, but I will try that out just in case, I'd rather keep compiler
> > optimizations enabled whenever/wherever possible. Thanks for the suggestion.
>
> I did this test right now but, unfortunately, that did not seem to be enough
> to get rid of the crash. That suggests the optimization must be disabled
> from somewhere else, I think I will try disabling it in some other places...</span >
Indeed, just disabling it in bmalloc did not work, but disabling it for WebCore **only** did get rid of the crash too, so I think that's the one I'm proposing.
More specifically, this patch fixed the issue as well as the previous one I proposed, but without removing the optimization from gcc when building bmalloc, WTF, JSC and the WebKit API layers: "only" from WebCore, which is better.
See the proposed diff below:
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 564a239..794caeb 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -3574,6 +3574,14 @@ add_library(WebCore ${WebCore_LIBRARY_TYPE} ${WebCore_SOURCES})
set_target_properties(WebCore PROPERTIES COMPILE_DEFINITIONS "BUILDING_WebCore")
set_target_properties(WebCore PROPERTIES FOLDER "WebCore")
+# The -ftree-sra optimization (implicit with -O2) causes crashes when
+# allocating large chunks of memory using bmalloc on Intel 32bit.
+# See <a class="bz_bug_link
bz_status_NEW "
title="NEW - Crash on xLarge memory allocation using bmalloc on 32bit systems"
href="show_bug.cgi?id=146440">https://bugs.webkit.org/show_bug.cgi?id=146440</a>
+string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
+if (CMAKE_COMPILER_IS_GNUCXX AND "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|x86)")
+ ADD_TARGET_PROPERTIES(WebCore COMPILE_FLAGS "-fno-tree-sra")
+endif ()
+
if (WebCore_OUTPUT_NAME)
set_target_properties(WebCore PROPERTIES OUTPUT_NAME ${WebCore_OUTPUT_NAME})
endif ()
What do you think? Is this worth proposing upstream?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>