<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&#64;webkit.org" title="Mario Sanchez Prada &lt;mario&#64;webkit.org&gt;"> <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">&gt; (In reply to <a href="show_bug.cgi?id=146440#c6">comment #6</a>)
&gt; &gt; (In reply to <a href="show_bug.cgi?id=146440#c4">comment #4</a>)
&gt; &gt; &gt; [...]
&gt; &gt; &gt; What about setting this flag only for the bmalloc source files at
&gt; &gt; &gt; Source/bmalloc/CMakeLists.txt . Would it be enough?
&gt; &gt; 
&gt; &gt; Not sure, but I will try that out just in case, I'd rather keep compiler
&gt; &gt; optimizations enabled whenever/wherever possible. Thanks for the suggestion.
&gt; 
&gt; I did this test right now but, unfortunately, that did not seem to be enough
&gt; to get rid of the crash. That suggests the optimization must be disabled
&gt; 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: &quot;only&quot; 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
&#64;&#64; -3574,6 +3574,14 &#64;&#64; add_library(WebCore ${WebCore_LIBRARY_TYPE} ${WebCore_SOURCES})
 set_target_properties(WebCore PROPERTIES COMPILE_DEFINITIONS &quot;BUILDING_WebCore&quot;)
 set_target_properties(WebCore PROPERTIES FOLDER &quot;WebCore&quot;)

+# 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 &quot;${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}&quot; MATCHES &quot;(i[3-6]86|x86)&quot;)
+    ADD_TARGET_PROPERTIES(WebCore COMPILE_FLAGS &quot;-fno-tree-sra&quot;)
+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>