<?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>126985</bug_id>
          
          <creation_ts>2014-01-14 07:39:38 -0800</creation_ts>
          <short_desc>Source/WTF/wtf/Atomics.h:300: Error: bad register name `%bpl&apos;</short_desc>
          <delta_ts>2014-01-16 13:39:43 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Template Framework</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</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>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alberto Garcia">berto</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>benjamin</cc>
    
    <cc>cmarcelo</cc>
    
    <cc>commit-queue</cc>
    
    <cc>David.Ronis</cc>
    
    <cc>oliver</cc>
    
    <cc>tpopela</cc>
    
    <cc>zan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>967831</commentid>
    <comment_count>0</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2014-01-14 07:39:38 -0800</bug_when>
    <thetext>I&apos;m having problems building the GTK+ port in i386. Looks like gcc is producing x86-64 registers here:

inline bool weakCompareAndSwap(uint8_t* location, uint8_t expected, uint8_t newValue)
{
    unsigned char result;
    asm volatile(
        &quot;lock; cmpxchgb %3, %2\n\t&quot;
        &quot;sete %1&quot;
        : &quot;+a&quot;(expected), &quot;=q&quot;(result), &quot;+m&quot;(*location)
        : &quot;r&quot;(newValue)
        : &quot;memory&quot;
        );
    return result;
}

Here&apos;s the gcc output of the affected pre-processed source file:

$ gcc -O1 -m32 --std=c++11 -c CodeBlock.ii 
../Source/WTF/wtf/Atomics.h: Assembler messages:
../Source/WTF/wtf/Atomics.h:300: Error: bad register name `%bpl&apos;
../Source/WTF/wtf/Atomics.h:300: Error: bad register name `%bpl&apos;
../Source/WTF/wtf/Atomics.h:300: Error: bad register name `%dil&apos;

Adding -frename-registers seems to solve the problem. It also builds fine with clang.

My understanding is that this is a gcc bug, however reading the upstream
report http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10153 and its duplicates
suggests that the constraints in the function I pasted above might be wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>967905</commentid>
    <comment_count>1</comment_count>
    <who name="Zan Dobersek">zan</who>
    <bug_when>2014-01-14 10:26:07 -0800</bug_when>
    <thetext>*** Bug 126989 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>968046</commentid>
    <comment_count>2</comment_count>
    <who name="David Ronis">David.Ronis</who>
    <bug_when>2014-01-14 14:35:21 -0800</bug_when>
    <thetext>I added -frename-registers to the build CFLAGS and CXXFLAGS.  I get the exact same message as in my initial report:

./Source/WTF/wtf/Atomics.h: Assembler messages:
./Source/WTF/wtf/Atomics.h:300: Error: bad register name `%sil&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>968707</commentid>
    <comment_count>3</comment_count>
      <attachid>221366</attachid>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2014-01-16 04:39:04 -0800</bug_when>
    <thetext>Created attachment 221366
Patch

The problem is that with the &quot;r&quot; constraint we are telling gcc to put
&apos;newValue&apos; into any general register, which is then used as an operand
for cmpxchgb.

However in i386 not all registers allow access to their lower byte,
which is what we need here.

The &quot;q&quot; constraint ensures that in 32-bit mode only the a, b, c and d
registers are used.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>968708</commentid>
    <comment_count>4</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2014-01-16 04:40:37 -0800</bug_when>
    <thetext>Attachment 221366 did not pass style-queue:

Failed to run &quot;[&apos;Tools/Scripts/check-webkit-style&apos;, &apos;--diff-files&apos;, u&apos;Source/WTF/ChangeLog&apos;, u&apos;Source/WTF/wtf/Atomics.h&apos;, &apos;--commit-queue&apos;]&quot; exit_code: 1
ERROR: Source/WTF/wtf/Atomics.h:298:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
ERROR: Source/WTF/wtf/Atomics.h:298:  Wrong number of spaces before statement. (expected: 12)  [whitespace/indent] [4]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>968772</commentid>
    <comment_count>5</comment_count>
      <attachid>221366</attachid>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2014-01-16 08:47:51 -0800</bug_when>
    <thetext>Comment on attachment 221366
Patch

LGTM, r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>968826</commentid>
    <comment_count>6</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2014-01-16 11:19:42 -0800</bug_when>
    <thetext>Committed r162137: &lt;http://trac.webkit.org/changeset/162137&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>968908</commentid>
    <comment_count>7</comment_count>
    <who name="David Ronis">David.Ronis</who>
    <bug_when>2014-01-16 13:39:43 -0800</bug_when>
    <thetext>I just finished my build with the patch, it worked (Note:  I still had 
-frename-registers in my CFLAGS/CXXFLAGS)

Thanks</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>221366</attachid>
            <date>2014-01-16 04:39:04 -0800</date>
            <delta_ts>2014-01-16 08:47:51 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>126985.diff</filename>
            <type>text/plain</type>
            <size>1127</size>
            <attacher name="Alberto Garcia">berto</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XVEYvQ2hhbmdlTG9nIGIvU291cmNlL1dURi9DaGFuZ2VMb2cK
aW5kZXggMjc0ZDg2Yi4uNDliYWExNSAxMDA2NDQKLS0tIGEvU291cmNlL1dURi9DaGFuZ2VMb2cK
KysrIGIvU291cmNlL1dURi9DaGFuZ2VMb2cKQEAgLTEsMyArMSwxNiBAQAorMjAxNC0wMS0xNiAg
QWxiZXJ0byBHYXJjaWEgIDxiZXJ0b0BpZ2FsaWEuY29tPgorCisgICAgICAgIFNvdXJjZS9XVEYv
d3RmL0F0b21pY3MuaDozMDA6IEVycm9yOiBiYWQgcmVnaXN0ZXIgbmFtZSBgJWJwbCcKKyAgICAg
ICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTEyNjk4NQorCisgICAg
ICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIFVzZSB0aGUgJ3EnIGNv
bnN0cmFpbnQgdG8gZm9yY2UgdXNpbmcgYSByZWdpc3RlciB0aGF0IGFsbG93cworICAgICAgICBh
Y2Nlc3MgdG8gaXRzIGxvd2VyIGJ5dGUuCisKKyAgICAgICAgKiB3dGYvQXRvbWljcy5oOgorICAg
ICAgICAoV1RGOjp3ZWFrQ29tcGFyZUFuZFN3YXApOgorCiAyMDE0LTAxLTE1ICBBbGJlcnRvIEdh
cmNpYSAgPGJlcnRvQGlnYWxpYS5jb20+CiAKICAgICAgICAgW0dUS10gdjIuMy4zIGZhaWxzIHRv
IGJ1aWxkIGluIERlYmlhbiAvIEZyZWVCU0QKZGlmZiAtLWdpdCBhL1NvdXJjZS9XVEYvd3RmL0F0
b21pY3MuaCBiL1NvdXJjZS9XVEYvd3RmL0F0b21pY3MuaAppbmRleCBlNDAxMWFiLi44Mjk2MGY5
IDEwMDY0NAotLS0gYS9Tb3VyY2UvV1RGL3d0Zi9BdG9taWNzLmgKKysrIGIvU291cmNlL1dURi93
dGYvQXRvbWljcy5oCkBAIC0yOTUsNyArMjk1LDcgQEAgaW5saW5lIGJvb2wgd2Vha0NvbXBhcmVB
bmRTd2FwKHVpbnQ4X3QqIGxvY2F0aW9uLCB1aW50OF90IGV4cGVjdGVkLCB1aW50OF90IG5ld1YK
ICAgICAgICAgImxvY2s7IGNtcHhjaGdiICUzLCAlMlxuXHQiCiAgICAgICAgICJzZXRlICUxIgog
ICAgICAgICA6ICIrYSIoZXhwZWN0ZWQpLCAiPXEiKHJlc3VsdCksICIrbSIoKmxvY2F0aW9uKQot
ICAgICAgICA6ICJyIihuZXdWYWx1ZSkKKyAgICAgICAgOiAicSIobmV3VmFsdWUpCiAgICAgICAg
IDogIm1lbW9yeSIKICAgICAgICAgKTsKICAgICByZXR1cm4gcmVzdWx0Owo=
</data>
<flag name="review"
          id="245267"
          type_id="1"
          status="+"
          setter="ossy"
    />
          </attachment>
      

    </bug>

</bugzilla>