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

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>241377</bug_id>
          
          <creation_ts>2010-06-11 06:04:57 +0000</creation_ts>
          <short_desc>Unhandled instruction on MacOS 10.6</short_desc>
          <delta_ts>2010-09-02 14:24:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Developer tools</classification>
          <product>valgrind</product>
          <component>memcheck</component>
          <version>unspecified</version>
          <rep_platform>Unlisted Binaries</rep_platform>
          <op_sys>macOS</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="x">mrxonix</reporter>
          <assigned_to name="Julian Seward">jseward</assigned_to>
          <cc>glider</cc>
    
    <cc>kimmeh</cc>
    
    <cc>rubengarciahernandez</cc>
    
    <cc>siegel</cc>
    
    <cc>tom</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>976838</commentid>
    <comment_count>0</comment_count>
    <who name="x">mrxonix</who>
    <bug_when>2010-06-11 06:04:57 +0000</bug_when>
    <thetext>Version:           unspecified
OS:                OS X

This is the report I get from valgrind:

vex x86-&gt;IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xA
==94567== valgrind: Unrecognised instruction at address 0x727902.

Happens fairly universally when I try to run valgrind on many common MacOS binaries. seems to be triggered by calls to &quot;floorf$fenv_access_off&quot; and similar. 

Reproducible: Didn&apos;t try

Steps to Reproduce:
use valgrind on any GUI-using binaries on 10.6. firefox or thunderbird do the trick.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>976980</commentid>
    <comment_count>1</comment_count>
    <who name="Tom Hughes">tom</who>
    <bug_when>2010-06-11 12:52:55 +0000</bug_when>
    <thetext>This is the roundss SSE4 instruction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>976982</commentid>
    <comment_count>2</comment_count>
    <who name="Tom Hughes">tom</who>
    <bug_when>2010-06-11 12:54:31 +0000</bug_when>
    <thetext>There is a related report for roundsd in bug #197266.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>977102</commentid>
    <comment_count>3</comment_count>
    <who name="x">mrxonix</who>
    <bug_when>2010-06-11 17:15:02 +0000</bug_when>
    <thetext>I suppose then, based on the previous report, no quick workaround to this? 

Rounding op is pretty common (used in system library), evidently so this precludes Valgrind from working on anything application that uses floating point under OS X 10.6</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>980290</commentid>
    <comment_count>4</comment_count>
    <who name="Alexander Potapenko">glider</who>
    <bug_when>2010-06-19 10:38:27 +0000</bug_when>
    <thetext>John Grabowski from Chromium team reports the same bug on 10.6, see http://code.google.com/p/chromium/issues/detail?id=46947</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>980298</commentid>
    <comment_count>5</comment_count>
    <who name="Julian Seward">jseward</who>
    <bug_when>2010-06-19 11:00:48 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; so this
&gt; precludes Valgrind from working on anything application that uses floating
&gt; point under OS X 10.6

That&apos;s not exactly correct -- it only is a problem on Core iX processors
and later model Core 2&apos;s (Core 2 8xxx).  Anyway, I have been working
through SSE4 instructions recently and will look at implementing ROUNDxx
next.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>988514</commentid>
    <comment_count>6</comment_count>
    <who name="Alexander Potapenko">glider</who>
    <bug_when>2010-07-11 13:11:14 +0000</bug_when>
    <thetext>Just for the record: we&apos;ve built Valgrind r11195 (after the MACOSX106 merge), but the error reported at http://code.google.com/p/chromium/issues/detail?id=46947 is still there. Looks like the Chromium test calls _ceilf() from /usr/lib/libSystem.B.dylib, which has the following implementation on that machine:


00059350 &lt;_ceilf&gt;:
   59350:       f3 0f 10 44 24 04       movss  0x4(%esp),%xmm0
   59356:       f7 05 20 00 ff ff 00    testl  $0x400,0xffff0020
   5935d:       04 00 00 
   59360:       74 1e                   je     59380 &lt;_ceilf+0x30&gt;
   59362:       66 0f 3a 0a c0 02       roundss $0x2,%xmm0,%xmm0
   59368:       f3 0f 11 44 24 04       movss  %xmm0,0x4(%esp)
   5936e:       d9 44 24 04             flds   0x4(%esp)
   59372:       c3                      ret    
   59373:       66 0f 1f 44 00 00       nopw   0x0(%eax,%eax,1)
   59379:       0f 1f 80 00 00 00 00    nopl   0x0(%eax)
   59380:       8b 44 24 04             mov    0x4(%esp),%eax
   59384:       b1 17                   mov    $0x17,%cl
   59386:       89 c2                   mov    %eax,%edx
   59388:       d3 e8                   shr    %cl,%eax
...

For some strange reason Valgrind still complains about the roundss insruction (0x66 0xF 0x3A 0xA) in this function, although it doesn&apos;t in a small binary that just executes roundss. I&apos;m working on a stable reproducer for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>988893</commentid>
    <comment_count>7</comment_count>
    <who name="Julian Seward">jseward</who>
    <bug_when>2010-07-12 15:35:11 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; Just for the record: we&apos;ve built Valgrind r11195 (after the MACOSX106 merge),
&gt; but the error reported at
&gt; http://code.google.com/p/chromium/issues/detail?id=46947 is still there. 

You are running a 32-bit executable.  The fix I made is for 64-bit only
(so far, all SSE4 support is 64-bit only, due to time constraints).  Try
again as a 64-bit process.  64-bit MACOSX support now works pretty well
so there is no reason not to use it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>989059</commentid>
    <comment_count>8</comment_count>
    <who name="Alexander Potapenko">glider</who>
    <bug_when>2010-07-12 18:33:07 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; You are running a 32-bit executable.  The fix I made is for 64-bit only
&gt; (so far, all SSE4 support is 64-bit only, due to time constraints).  Try
&gt; again as a 64-bit process.  64-bit MACOSX support now works pretty well
&gt; so there is no reason not to use it.

Unfortunately we don&apos;t support 64-bit builds of Chromium on Mac yet.
Am I understanding you right that SSE4 could be implemented for 32-bit in the same way?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>989066</commentid>
    <comment_count>9</comment_count>
    <who name="Rich Siegel">siegel</who>
    <bug_when>2010-07-12 18:58:55 +0000</bug_when>
    <thetext>This is an issue for other applications/projects/developers as well -- unfortunately, building 64-bit is not an option for several of the projects I work on, which still need to link against some 32-bit-only system frameworks and use some 32-bit-only APIs. So, if there&apos;s a fast path to making SSE4 work for 32-bit executables as well, that would be great.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>989106</commentid>
    <comment_count>10</comment_count>
    <who name="Julian Seward">jseward</who>
    <bug_when>2010-07-12 20:42:43 +0000</bug_when>
    <thetext>&gt; Am I understanding you right that SSE4 could be implemented for 32-bit in the
&gt; same way?

Yes.  It would take some work though, which is why I had hoped to complete
the SSE4 instructions for 64-bit mode before extending it to 32-bit mode.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>989109</commentid>
    <comment_count>11</comment_count>
    <who name="Julian Seward">jseward</who>
    <bug_when>2010-07-12 20:50:57 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; and use some 32-bit-only APIs. So, if there&apos;s a fast path to making SSE4 work
&gt; for 32-bit executables as well, that would be great.

I suspect only a relatively small subset of SSE4 would be needed for 32-bit
SSE4 support on 10.6.  I only have access to a SSSE3 capable machine for 
10.6, so I can&apos;t test this.  If anyone is happy to provide a ssh login on
a SSE4 capable 10.6 box, I could at least make a preliminary assessment
of what needs to be done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>989121</commentid>
    <comment_count>12</comment_count>
    <who name="Rich Siegel">siegel</who>
    <bug_when>2010-07-12 21:20:42 +0000</bug_when>
    <thetext>(In reply to comment #11)

&gt; I suspect only a relatively small subset of SSE4 would be needed for 32-bit
&gt; SSE4 support on 10.6.  I only have access to a SSSE3 capable machine for 
&gt; 10.6, so I can&apos;t test this.  If anyone is happy to provide a ssh login on
&gt; a SSE4 capable 10.6 box, I could at least make a preliminary assessment
&gt; of what needs to be done.

It looks like any machine manufactured after mid-2008 would qualify; as far as I can tell, SSE4 was introduced with Penryn. I&apos;ll see if I can find something to get you an account on. :-) Meanwhile, what do you have access to today?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>989139</commentid>
    <comment_count>13</comment_count>
    <who name="Julian Seward">jseward</who>
    <bug_when>2010-07-12 21:49:18 +0000</bug_when>
    <thetext>Well, SSE4 was introduced in two parts, SSE4.1 and SSE4.2.  4.1 became
available on 45nm Core 2&apos;s, that is, Core 2 E8xxx.  4.2 became available
on Core iX.  For running MacOS I only have an older Core2 E6xxx so I&apos;m
pretty sure it won&apos;t even do 4.1.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>993564</commentid>
    <comment_count>14</comment_count>
    <who name="Julian Seward">jseward</who>
    <bug_when>2010-07-23 23:25:28 +0000</bug_when>
    <thetext>Fixed (vex r1987).  At least, this provides support for roundss
in 32-bit mode, so that calls to floorf now succeed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>993566</commentid>
    <comment_count>15</comment_count>
    <who name="Julian Seward">jseward</who>
    <bug_when>2010-07-23 23:27:43 +0000</bug_when>
    <thetext>*** Bug 236546 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1011333</commentid>
    <comment_count>16</comment_count>
    <who name="Ruben Garcia">rubengarciahernandez</who>
    <bug_when>2010-08-30 11:02:06 +0000</bug_when>
    <thetext>It does not seem to be completely fixed. I&apos;m getting this error in Ogre3D for MAC OSX. Ogre3D runs only in 32 bit mode. 

valgrind svn as of 30-08-2010, ogre3D 1.7.1

vex x86-&gt;IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xA
==12515== valgrind: Unrecognised instruction at address 0x1b58182.
==12515== Your program just tried to execute an instruction that Valgrind
==12515== did not recognise.  There are two possible reasons for this.
==12515== 1. Your program has a bug and erroneously jumped to a non-code
==12515==    location.  If you are running Memcheck and you just saw a
==12515==    warning about a bad jump, it&apos;s probably your program&apos;s fault.
==12515== 2. The instruction is legitimate but Valgrind doesn&apos;t handle it,
==12515==    i.e. it&apos;s Valgrind&apos;s fault.  If you think this is the case or
==12515==    you are not sure, please let us know and we&apos;ll try to fix it.
==12515== Either way, Valgrind will now raise a SIGILL signal which will
==12515== probably kill your program.
==12515== 
==12515== Process terminating with default action of signal 4 (SIGILL)
==12515==  Illegal opcode at address 0x1B58182
==12515==    at 0x1B58182: ceilf$fenv_access_off (in /usr/lib/libSystem.B.dylib)
==12515==    by 0x315A886: _HIMenuGetMenuBarHeight (in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox)
==12515==    by 0x23F73DF: _NSMenuBarHeight (in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==12515==    by 0x23F7388: -[NSScreen _saveVisibleFrameAtIndex:] (in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==12515==    by 0x23F72FB: +[NSScreen _updateSavedFrames] (in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==12515==    by 0x23F70CB: +[NSScreen screens] (in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==12515==    by 0x23FC137: +[NSScreen _zeroScreen] (in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==12515==    by 0x23FF4A0: +[NSScreen mainScreen] (in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==12515==    by 0x23F1014: -[NSWindow _initContent:styleMask:backing:defer:contentView:] (in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==12515==    by 0x23F0EB2: -[NSWindow initWithContentRect:styleMask:backing:defer:] (in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit)
==12515==    by 0x4A8642: -[OgreConfigWindowDelegate init] (in /Library/Frameworks/Ogre.framework/Versions/1.7.1/Ogre)
==12515==    by 0x4A7189: Ogre::ConfigDialog::initialise() (in /Library/Frameworks/Ogre.framework/Versions/1.7.1/Ogre)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1011334</commentid>
    <comment_count>17</comment_count>
    <who name="Ruben Garcia">rubengarciahernandez</who>
    <bug_when>2010-08-30 11:07:34 +0000</bug_when>
    <thetext>My valgrind version is svn 11308. I&apos;m running osx 10.6 as well. 

Please reopen this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1012756</commentid>
    <comment_count>18</comment_count>
    <who name="Julian Seward">jseward</who>
    <bug_when>2010-09-01 18:29:29 +0000</bug_when>
    <thetext>(In reply to comment #16)
&gt; It does not seem to be completely fixed. I&apos;m getting this error in Ogre3D for
&gt; MAC OSX. Ogre3D runs only in 32 bit mode. 
&gt; 
&gt; valgrind svn as of 30-08-2010, ogre3D 1.7.1
&gt; 
&gt; vex x86-&gt;IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xA

It might be actually pretty easy to fix.  However, I need to see the
bytes that follow the 0xA above, so I know exactly what the
instruction is. Can you either:

* disassemble /usr/lib/libSystem.B.dylib and find the instruction
  (could be difficult), or

* (possibly easier) edit guest_x86_toIR.c, find where the &quot;unhandled
  instruction bytes&quot; message is printed, modify it to print 8 bytes
  instead of 4, and re-run.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1012764</commentid>
    <comment_count>19</comment_count>
    <who name="Ruben Garcia">rubengarciahernandez</who>
    <bug_when>2010-09-01 18:45:42 +0000</bug_when>
    <thetext>I&apos;ll have a look at it tomorrow. Please consider changing guest_x86_toIR.c permanently in the svn, since other long instructions may exist or be added in the future.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1013256</commentid>
    <comment_count>20</comment_count>
    <who name="Ruben Garcia">rubengarciahernandez</who>
    <bug_when>2010-09-02 14:24:20 +0000</bug_when>
    <thetext>I just rechecked and the problem has been fixed. I was unknowingly using the valgrind version from macports, instead of my just compiled one.
(Both identify themselves as valgrind-3.6.0.SVN; perhaps the revision should be added somewhere).

Sorry for the mistake.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>