<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - REGRESSION (r205107): ASSERTION FAILED: !(reinterpret_cast&lt;char*&gt;(this)[i])"
   href="https://bugs.webkit.org/show_bug.cgi?id=161308#c10">Comment # 10</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - REGRESSION (r205107): ASSERTION FAILED: !(reinterpret_cast&lt;char*&gt;(this)[i])"
   href="https://bugs.webkit.org/show_bug.cgi?id=161308">bug 161308</a>
              from <span class="vcard"><a class="email" href="mailto:clopez&#64;igalia.com" title="Carlos Alberto Lopez Perez &lt;clopez&#64;igalia.com&gt;"> <span class="fn">Carlos Alberto Lopez Perez</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=161308#c7">comment #7</a>)
<span class="quote">&gt; Ok.
&gt; Third guess, there is now 4 bytes of padding after the ArrayModes
&gt; m_arrayModes
&gt; field, maybe those aren't getting zeroed out? And for some reason, clang
&gt; zeroes
&gt; them out.</span >

It seems that the standard only guarantees that the padding in structures is zero-initialized on some very specific cases [1]. In the rest of cases it is undefined behaviour. And this seems to be one of this cases. That explains why clang is zero-initializing the padding of the structure, but GCC does not.

This fixes the issue with GCC:

--- a/Source/JavaScriptCore/dfg/DFGAbstractValue.h
+++ b/Source/JavaScriptCore/dfg/DFGAbstractValue.h
&#64;&#64; -191,21 +191,21 &#64;&#64; struct AbstractValue {

     static AbstractValue heapTop()
     {
-        AbstractValue result;
+        static AbstractValue result;
         result.makeHeapTop();
         return result;
     }

     static AbstractValue bytecodeTop()
     {
-        AbstractValue result;
+        static AbstractValue result;
         result.makeBytecodeTop();
         return result;
     }

     static AbstractValue fullTop()
     {
-        AbstractValue result;
+        static AbstractValue result;
         result.makeFullTop();
         return result;
     }



Now I wonder if this is the best approach (declaring it as static), or it will be better to directly bzero the structure on the constructor, or perhaps it will be better to modify the assert to check only the values of the members of the structure.


[1] <a href="https://gustedt.wordpress.com/2012/10/24/c11-defects-initialization-of-padding/">https://gustedt.wordpress.com/2012/10/24/c11-defects-initialization-of-padding/</a></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>