<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>26997</bug_id>
          
          <creation_ts>2009-07-06 13:28:48 -0700</creation_ts>
          <short_desc>[Chromium] Remove buggy usage of DEFINE_STATIC_LOCAL in V8Binding.cpp</short_desc>
          <delta_ts>2009-07-10 13:30:25 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Nate Chapin">japhet</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>darin</cc>
    
    <cc>dglazkov</cc>
    
    <cc>eric</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>129986</commentid>
    <comment_count>0</comment_count>
    <who name="Nate Chapin">japhet</who>
    <bug_when>2009-07-06 13:28:48 -0700</bug_when>
    <thetext>....this usage of DEFINE_STATIC_LOCAL is causing a bunch of layout test failures for Chromium.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129988</commentid>
    <comment_count>1</comment_count>
      <attachid>32313</attachid>
    <who name="Nate Chapin">japhet</who>
    <bug_when>2009-07-06 13:31:44 -0700</bug_when>
    <thetext>Created attachment 32313
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129998</commentid>
    <comment_count>2</comment_count>
      <attachid>32313</attachid>
    <who name="Dimitri Glazkov (Google)">dglazkov</who>
    <bug_when>2009-07-06 13:46:56 -0700</bug_when>
    <thetext>Comment on attachment 32313
patch

ok.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130038</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-07-06 15:34:01 -0700</bug_when>
    <thetext>Why is this bad usage?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130039</commentid>
    <comment_count>4</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-07-06 15:34:24 -0700</bug_when>
    <thetext>CCing Darin who knows more about this macro than I do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130040</commentid>
    <comment_count>5</comment_count>
    <who name="Nate Chapin">japhet</who>
    <bug_when>2009-07-06 15:39:34 -0700</bug_when>
    <thetext>To be honest, I&apos;m not 100% sure what I did wrong here.  All I know is that I clearly didn&apos;t initialize it correctly, because the test shell was consistently crashing when lowNumbers[foo] was used a couple lines below the DEFINE_STATIC_LOCAL().

I probably should have included a FIXME to use DEFINE_STATIC_LOCAL properly instead of the traditional static variable declaration.  I just wanted to get it working so that we could finish upstreaming V8Binding and get the chromium canary builder green again.  

However, it&apos;s looking like I&apos;m going to be rolling this change and the one that introduced the bug back due to the chromium build mess and the fact that I won&apos;t be able to clean up after myself tonight.  If someone can help me figure out how to correctly use DEFINE_STATIC_LOCAL in this situation, I&apos;ll happily do it right when I re-upstream V8Binding.cpp tomorrow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130044</commentid>
    <comment_count>6</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-07-06 15:51:28 -0700</bug_when>
    <thetext>From StdLibExtras.h:

// Use these to declare and define a static local variable (static T;) so that
//  it is leaked so that its destructors are not called at exit. Using this
//  macro also allows workarounds a compiler bug present in Apple&apos;s version of GCC 4.0.1.
#if COMPILER(GCC) &amp;&amp; defined(__APPLE_CC__) &amp;&amp; __GNUC__ == 4 &amp;&amp; __GNUC_MINOR__ == 0 &amp;&amp; __GNUC_PATCHLEVEL__ == 1
#define DEFINE_STATIC_LOCAL(type, name, arguments) \
    static type* name##Ptr = new type arguments; \
    type&amp; name = *name##Ptr
#else
#define DEFINE_STATIC_LOCAL(type, name, arguments) \
    static type&amp; name = *new type arguments
#endif

These exist only to work around bugs in GCC 4.0.1 on Macs.  I don&apos;t know enough about the bug to comment further however.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130928</commentid>
    <comment_count>7</comment_count>
    <who name="Dimitri Glazkov (Google)">dglazkov</who>
    <bug_when>2009-07-10 13:22:29 -0700</bug_when>
    <thetext>Has this landed?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130933</commentid>
    <comment_count>8</comment_count>
    <who name="Nate Chapin">japhet</who>
    <bug_when>2009-07-10 13:30:25 -0700</bug_when>
    <thetext>This has landed, but I left it open since I wasn&apos;t sure whether the conversation was going to continue regarding my original usage of DEFINE_STATIC_LOCAL.  The current version of the file in the repository does not use DEFINE_STATIC_LOCAL.  If it should, I&apos;m happy to take care of it, but I guess I&apos;ll close this issue out in the meantime.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>32313</attachid>
            <date>2009-07-06 13:31:44 -0700</date>
            <delta_ts>2009-07-06 13:46:56 -0700</delta_ts>
            <desc>patch</desc>
            <filename>patch.txt</filename>
            <type>text/plain</type>
            <size>1519</size>
            <attacher name="Nate Chapin">japhet</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA0NTU2MCkKKysrIFdlYkNvcm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0Zi9TdGRM
aWJFeHRyYXMuaD4KIAogbmFtZXNwYWNlIFdlYkNvcmUgewogCkBAIC0xMDIsNyArMTAxLDcgQEAg
U3RyaW5nIHY4VmFsdWVUb1dlYkNvcmVTdHJpbmcodjg6OkhhbmRsZQogICAgICAgICBpbnQgdmFs
dWUgPSBvYmplY3QtPkludDMyVmFsdWUoKTsKICAgICAgICAgLy8gTW9zdCBudW1iZXJzIHVzZWQg
YXJlIDw9IDEwMC4gRXZlbiBpZiB0aGV5IGFyZW4ndCB1c2VkIHRoZXJlJ3MgdmVyeSBsaXR0bGUg
aW4gdXNpbmcgdGhlIHNwYWNlLgogICAgICAgICBjb25zdCBpbnQga0xvd051bWJlcnMgPSAxMDA7
Ci0gICAgICAgIERFRklORV9TVEFUSUNfTE9DQUwoQXRvbWljU3RyaW5nKiwgbG93TnVtYmVycywg
W2tMb3dOdW1iZXJzICsgMV0pOworICAgICAgICBzdGF0aWMgQXRvbWljU3RyaW5nIGxvd051bWJl
cnNba0xvd051bWJlcnMgKyAxXTsKICAgICAgICAgU3RyaW5nIHdlYkNvcmVTdHJpbmc7CiAgICAg
ICAgIGlmICgwIDw9IHZhbHVlICYmIHZhbHVlIDw9IGtMb3dOdW1iZXJzKSB7CiAgICAgICAgICAg
ICB3ZWJDb3JlU3RyaW5nID0gbG93TnVtYmVyc1t2YWx1ZV07Cg==
</data>
<flag name="review"
          id="16776"
          type_id="1"
          status="+"
          setter="dglazkov"
    />
          </attachment>
      

    </bug>

</bugzilla>