<?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>201670</bug_id>
          
          <creation_ts>2009-07-27 16:51:07 +0000</creation_ts>
          <short_desc>Result of conversion of double to long long differs in valgrind and non-valgrind runs</short_desc>
          <delta_ts>2009-07-28 11:41:00 +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>general</component>
          <version>unspecified</version>
          <rep_platform>Ubuntu</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>197915</dup_id>
          
          <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>rudolf.hornig</reporter>
          <assigned_to name="Julian Seward">jseward</assigned_to>
          <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>799540</commentid>
    <comment_count>0</comment_count>
    <who name="">rudolf.hornig</who>
    <bug_when>2009-07-27 16:51:07 +0000</bug_when>
    <thetext>Version:           valgrind-3.4.1-Debian (using KDE 4.2.4)
Compiler:          gcc 4.3 
OS:                Linux
Installed from:    Ubuntu Packages

uname -a
Linux hal90000 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC 2009 i686 GNU/Linux

The output of the followinfg program differs it it is run under valgrind:

#include &lt;stdio.h&gt;

int main() {
  char *x = &quot;\x19\x6d\xb2\x9a\xba\x7e\x15\x40&quot;;
  double d = *(double *)x;
  printf(&quot;\nlong long:%lld \n&quot;, (long long)(d*(1e12)));
}

The output without valgrind:
long long:5373758713855

using valgrind:
long long:5373758713856</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>799703</commentid>
    <comment_count>1</comment_count>
    <who name="Nicholas Nethercote">njn</who>
    <bug_when>2009-07-28 00:24:12 +0000</bug_when>
    <thetext>This is probably a dup of bug 197915.  Rudolf, what do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>799867</commentid>
    <comment_count>2</comment_count>
    <who name="">rudolf.hornig</who>
    <bug_when>2009-07-28 11:34:28 +0000</bug_when>
    <thetext>Confirmed. After some research, I have recompiled the code with -msse2 -mfpmath=sse options (forcing to use 64bit floats on an intel CPU). and the valgrind and non-valgind output is now the same. 

Sorry for the confusion. This is really a dauplicate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>799871</commentid>
    <comment_count>3</comment_count>
    <who name="Tom Hughes">tom</who>
    <bug_when>2009-07-28 11:41:00 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 197915 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>