<?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>183409</bug_id>
          
          <creation_ts>2009-02-06 11:38:24 +0000</creation_ts>
          <short_desc>Valgrind does not support instructions sgdtq (x86_64) and sgdtl (x86)</short_desc>
          <delta_ts>2011-08-11 13:51:15 +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>vex</component>
          <version>3.4 SVN</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</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>crash</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>256630</blocked>
          <everconfirmed>0</everconfirmed>
          <reporter name="Konstantin Serebryany">konstantin.s.serebryany</reporter>
          <assigned_to name="Julian Seward">jseward</assigned_to>
          <cc>konstantin.s.serebryany</cc>
    
    <cc>njn</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>712578</commentid>
    <comment_count>0</comment_count>
    <who name="Konstantin Serebryany">konstantin.s.serebryany</who>
    <bug_when>2009-02-06 11:38:24 +0000</bug_when>
    <thetext>The following code will fail under valgrind like this: 
vex x86-&gt;IR: unhandled instruction bytes: 0xF 0x1 0x45 0xDE


#include &lt;iostream&gt;
#include &lt;pthread.h&gt;
// Compile and run:
// g++ -m64 sgdtq.cc -lpthread &amp;&amp; valgrind  ./a.out
void *sgdtq(void *) {
 char ret_val[16] __attribute__((__aligned__(16)));
 // valgrind will fail here:
 __asm__ __volatile__(&quot;sgdtq %0&quot; : &quot;=m&quot; (ret_val[6])::&quot;memory&quot;);
 uint64_t id =  *reinterpret_cast&lt;uint64_t *&gt;(&amp;ret_val[8]);
 std::cout &lt;&lt; id &lt;&lt; std::endl;
}

int main() {
 const int N = 100;
 pthread_t t[N];
 sgdtq(NULL);
 // start many threads. On a multi-cpu machine
 // this progam should print several different numbers.
 for (int i = 0; i &lt; N; i++) {
   pthread_create(&amp;t[i], 0, sgdtq, 0);
 }
 for (int i = 0; i &lt; N; i++) {
   pthread_join(t[i], 0);
 }
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1152636</commentid>
    <comment_count>1</comment_count>
    <who name="Tom Hughes">tom</who>
    <bug_when>2011-08-11 13:48:31 +0000</bug_when>
    <thetext>I&apos;m a bit confused - the error you quote is &quot;vex x86-&gt;IR&quot; which suggests you are running 32 bit code but the test program says to compile as 64 bit, and indeed it won&apos;t compile as 32 bit because gcc says that the &quot;sgdt&quot; instruction is not recognised.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1152639</commentid>
    <comment_count>2</comment_count>
    <who name="Tom Hughes">tom</who>
    <bug_when>2011-08-11 13:51:15 +0000</bug_when>
    <thetext>Well it compiles and runs OK as 64 bit anyway, and as 32 bit after the q suffix is dropped from that instruction.

Looks like VEX r1982 fixed it.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>