<?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>45669</bug_id>
          
          <creation_ts>2010-09-13 07:20:33 -0700</creation_ts>
          <short_desc>ARMv7Assembler generates illegal instructions with RVCT</short_desc>
          <delta_ts>2011-01-24 07:57:33 -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>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>47356</dup_id>
          
          <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>0</everconfirmed>
          <reporter name="David Tapuska">dave+webkit</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>loki</cc>
    
    <cc>oliver</cc>
    
    <cc>staikos</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>278192</commentid>
    <comment_count>0</comment_count>
    <who name="David Tapuska">dave+webkit</who>
    <bug_when>2010-09-13 07:20:33 -0700</bug_when>
    <thetext>Using RVCT to compile ARMv7Assembler illegal instructions occur because the ShiftTypeAmount class does not zero initialize all bits in the union. The type and amount values take up 7 bits leaving an extra unassigned bit in the union. GCC zero initializes bitfields but RVCT does not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278200</commentid>
    <comment_count>1</comment_count>
      <attachid>67406</attachid>
    <who name="David Tapuska">dave+webkit</who>
    <bug_when>2010-09-13 07:29:03 -0700</bug_when>
    <thetext>Created attachment 67406
Add an asInt member and ZI it</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278252</commentid>
    <comment_count>2</comment_count>
      <attachid>67406</attachid>
    <who name="Andreas Kling">kling</who>
    <bug_when>2010-09-13 09:36:42 -0700</bug_when>
    <thetext>Comment on attachment 67406
Add an asInt member and ZI it

&gt; +        int16_t asInt;

Shouldn&apos;t this be an 8-bit integer?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278319</commentid>
    <comment_count>3</comment_count>
      <attachid>67435</attachid>
    <who name="David Tapuska">dave+webkit</who>
    <bug_when>2010-09-13 11:14:16 -0700</bug_when>
    <thetext>Created attachment 67435
Add an asInt member and ZI it</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278358</commentid>
    <comment_count>4</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2010-09-13 11:52:55 -0700</bug_when>
    <thetext>Sigh, i really wish people would stop using RCVT it&apos;s clearly a broken compiler based on the amount of workarounds we&apos;ve had to do over time.

That said i fail to see how this patch will zero-init the entire union</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278376</commentid>
    <comment_count>5</comment_count>
    <who name="Gabor Loki">loki</who>
    <bug_when>2010-09-13 12:10:20 -0700</bug_when>
    <thetext>I will keep a check on this tomorrow.
Btw, David, which version of RVCT did you use?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278397</commentid>
    <comment_count>6</comment_count>
    <who name="David Tapuska">dave+webkit</who>
    <bug_when>2010-09-13 12:26:14 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; I will keep a check on this tomorrow.
&gt; Btw, David, which version of RVCT did you use?

$ armcc
ARM C/C++ Compiler, RVCT4.0 [Build 771]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278399</commentid>
    <comment_count>7</comment_count>
    <who name="David Tapuska">dave+webkit</who>
    <bug_when>2010-09-13 12:28:52 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; Sigh, i really wish people would stop using RCVT it&apos;s clearly a broken compiler based on the amount of workarounds we&apos;ve had to do over time.
&gt; 
&gt; That said i fail to see how this patch will zero-init the entire union

The ctors were changed to zero the asInt value. (This follows similar convention used in this header file for other structs with bitfields) The storage on the asInt should take up 8 bits which corresponds to the 4 bits on lo4 and 4 bits on hi4. The problem is with the code that the type and amount only take up 7 bits.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278768</commentid>
    <comment_count>8</comment_count>
    <who name="Gabor Loki">loki</who>
    <bug_when>2010-09-14 01:24:30 -0700</bug_when>
    <thetext>&gt; The ctors were changed to zero the asInt value. (This follows similar convention used in this header file for other structs with bitfields) The storage on the asInt should take up 8 bits which corresponds to the 4 bits on lo4 and 4 bits on hi4. The problem is with the code that the type and amount only take up 7 bits.

Although I did not find any initialization problem in a small example (very similar to ShiftTypeAndAmount with the very same compiler), I feel this 4/4 and 2/5 bits difference could lead to a bug. So, it should be fixed.

I have one comment to your patch. It is really looks like a workaround. I suggest you try to fix it in less hacky way. For example:

- unsigned hi4() { return m_u.s1.hi4; }
+ unsigned hi4() { return m_u.s1.hi4 &amp; 0x7; }

or

- unsigned hi4 : 4;
+ unsigned hi4 : 3;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278852</commentid>
    <comment_count>9</comment_count>
    <who name="David Tapuska">dave+webkit</who>
    <bug_when>2010-09-14 06:24:57 -0700</bug_when>
    <thetext>(In reply to comment #8)
&gt; &gt; The ctors were changed to zero the asInt value. (This follows similar convention used in this header file for other structs with bitfields) The storage on the asInt should take up 8 bits which corresponds to the 4 bits on lo4 and 4 bits on hi4. The problem is with the code that the type and amount only take up 7 bits.
&gt; 
&gt; Although I did not find any initialization problem in a small example (very similar to ShiftTypeAndAmount with the very same compiler), I feel this 4/4 and 2/5 bits difference could lead to a bug. So, it should be fixed.
&gt; 
&gt; I have one comment to your patch. It is really looks like a workaround. I suggest you try to fix it in less hacky way. For example:
&gt; 
&gt; - unsigned hi4() { return m_u.s1.hi4; }
&gt; + unsigned hi4() { return m_u.s1.hi4 &amp; 0x7; }
&gt; 
&gt; or
&gt; 
&gt; - unsigned hi4 : 4;
&gt; + unsigned hi4 : 3;

Did you try changing your memory allocator to hand out 0xff memset memory? You likely should hit it right away. Also you can inspect the asm generated by both and you&apos;ll see the difference. The reason I didn&apos;t make these changes because it doesn&apos;t match the method names. hi4 --&gt; 4 bits. hi4 member --&gt; 4 bits.. And this asInt style was used throughout the file as well to memset unions that don&apos;t fill out all the bits as well. Look at ThumbImmediateValue...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>278964</commentid>
    <comment_count>10</comment_count>
    <who name="Gabor Loki">loki</who>
    <bug_when>2010-09-14 09:23:13 -0700</bug_when>
    <thetext>&gt; Did you try changing your memory allocator to hand out 0xff memset memory? You likely should hit it right away. Also you can inspect the asm generated by both and you&apos;ll see the difference. 

No, but I see the problem.

&gt; The reason I didn&apos;t make these changes because it doesn&apos;t match the method names. hi4 --&gt; 4 bits. hi4 member --&gt; 4 bits.. 

Probably this was a wrong naming-convention. The shifts and rotates are encoded into 2 type bits and 5 immediate bits for immediate shifts and rotates (in both ARM and Thumb-2 instruction set cases). It is maybe misleading that those Thumb-2 instructions where an immediate shift can be applied contain a zero in the 15th bit place (right above the imm3 part of shift value). So, the hi4 should be a hi3 in this case.

&gt; And this asInt style was used throughout the file as well to memset unions that don&apos;t fill out all the bits as well. Look at ThumbImmediateValue...

Well, those asInt members are not just standing there for initialization/clearing unused bits. You can set and get value through asInt. ;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>279416</commentid>
    <comment_count>11</comment_count>
      <attachid>67435</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2010-09-14 23:53:10 -0700</bug_when>
    <thetext>Comment on attachment 67435
Add an asInt member and ZI it

Looks like its missing a ChangeLog.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>339015</commentid>
    <comment_count>12</comment_count>
    <who name="David Tapuska">dave+webkit</who>
    <bug_when>2011-01-24 07:57:33 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 47356 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>67406</attachid>
            <date>2010-09-13 07:29:03 -0700</date>
            <delta_ts>2010-09-13 11:14:16 -0700</delta_ts>
            <desc>Add an asInt member and ZI it</desc>
            <filename>45669.txt</filename>
            <type>text/plain</type>
            <size>1574</size>
            <attacher name="David Tapuska">dave+webkit</attacher>
            
              <data encoding="base64">Y29tbWl0IGY2ODRhYjVhMDE0NzhhMTBiNTNlOWQzY2VjMzI4NmQ1N2EyODYyMTMKQXV0aG9yOiBE
YXZlIFRhcHVza2EgPGR0YXB1c2thQHJpbS5jb20+CkRhdGU6ICAgTW9uIFNlcCAxMyAxMDoyODow
NiAyMDEwIC0wNDAwCgogICAgMjAxMC0wOS0xMCAgRGF2ZSBUYXB1c2thICA8ZHRhcHVza2FAcmlt
LmNvbT4KICAgIAogICAgICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KICAgIAog
ICAgICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9NDU2NjkK
ICAgIAogICAgICAgICAgICBSVkNUIGRvZXNuJ3QgWkkgYml0ZmllbGRzLiBFbnN1cmUgdGhhdCB3
ZSBaSSBhbGwgdGhlIGJpdHMgb3IKICAgICAgICAgICAgd2UgY2FuIGVuZCB1cCB3aXRoIGEgYm9n
dXMgYml0IGFuZCBnZW5lcmF0aW5nIGJhZCBpbnN0cnVjdGlvbnMuCiAgICAKICAgICAgICAgICAg
KiBKYXZhU2NyaXB0Q29yZS9hc3NlbWJsZXIvQVJNdjdBc3NlbWJsZXIuaDoKCmRpZmYgLS1naXQg
YS9KYXZhU2NyaXB0Q29yZS9hc3NlbWJsZXIvQVJNdjdBc3NlbWJsZXIuaCBiL0phd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dS50eXBlID0gdHlw
ZTsKICAgICAgICAgbV91LmFtb3VudCA9IGFtb3VudCAmIDMxOwogICAgIH0KQEAgLTQzNiw2ICs0
MzcsNyBAQCBwdWJsaWM6CiAgICAgCiBwcml2YXRlOgogICAgIHVuaW9uIHsKKyAgICAgICAgaW50
MTZfdCBhc0ludDsKICAgICAgICAgc3RydWN0IHsKICAgICAgICAgICAgIHVuc2lnbmVkIGxvNCA6
IDQ7CiAgICAgICAgICAgICB1bnNpZ25lZCBoaTQgOiA0Owo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>67435</attachid>
            <date>2010-09-13 11:14:16 -0700</date>
            <delta_ts>2010-09-14 23:53:10 -0700</delta_ts>
            <desc>Add an asInt member and ZI it</desc>
            <filename>45669.txt</filename>
            <type>text/plain</type>
            <size>1574</size>
            <attacher name="David Tapuska">dave+webkit</attacher>
            
              <data encoding="base64">Y29tbWl0IDA4NzBmNDFkOTE0ZWYxYmNkN2FhOTBjMmI5MGQ0MjY5Mjc2ZDcwZTgKQXV0aG9yOiBE
YXZlIFRhcHVza2EgPGR0YXB1c2thQHJpbS5jb20+CkRhdGU6ICAgTW9uIFNlcCAxMyAxMDoyODow
NiAyMDEwIC0wNDAwCgogICAgMjAxMC0wOS0xMCAgRGF2ZSBUYXB1c2thICA8ZHRhcHVza2FAcmlt
LmNvbT4KICAgIAogICAgICAgICAgICBSZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KICAgIAog
ICAgICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9NDU2NjkK
ICAgIAogICAgICAgICAgICBSVkNUIGRvZXNuJ3QgWkkgYml0ZmllbGRzLiBFbnN1cmUgdGhhdCB3
ZSBaSSBhbGwgdGhlIGJpdHMgb3IKICAgICAgICAgICAgd2UgY2FuIGVuZCB1cCB3aXRoIGEgYm9n
dXMgYml0IGFuZCBnZW5lcmF0aW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fdS5hbW91bnQgPSAwOworICAgICAgICBtX3UuYXNJbnQgPSAwOwogICAgIH0KICAgICAK
ICAgICBTaGlmdFR5cGVBbmRBbW91bnQoQVJNU2hpZnRUeXBlIHR5cGUsIHVuc2lnbmVkIGFtb3Vu
dCkKICAgICB7CisgICAgICAgIG1fdS5hc0ludCA9IDA7CiAgICAgICAgIG1fdS50eXBlID0gdHlw
ZTsKICAgICAgICAgbV91LmFtb3VudCA9IGFtb3VudCAmIDMxOwogICAgIH0KQEAgLTQzNCw2ICs0
MzUsNyBAQCBwdWJsaWM6CiAgICAgCiBwcml2YXRlOgogICAgIHVuaW9uIHsKKyAgICAgICAgdWlu
dDhfdCBhc0ludDsKICAgICAgICAgc3RydWN0IHsKICAgICAgICAgICAgIHVuc2lnbmVkIGxvNCA6
IDQ7CiAgICAgICAgICAgICB1bnNpZ25lZCBoaTQgOiA0Owo=
</data>
<flag name="review"
          id="56729"
          type_id="1"
          status="-"
          setter="eric"
    />
          </attachment>
      

    </bug>

</bugzilla>