Bug 201670 - Result of conversion of double to long long differs in valgrind and non-valgrind runs
Summary: Result of conversion of double to long long differs in valgrind and non-valgr...
Status: RESOLVED DUPLICATE of bug 197915
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-27 16:51 UTC by rudolf.hornig
Modified: 2009-07-28 11:41 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rudolf.hornig 2009-07-27 16:51:07 UTC
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 <stdio.h>

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

The output without valgrind:
long long:5373758713855

using valgrind:
long long:5373758713856
Comment 1 Nicholas Nethercote 2009-07-28 00:24:12 UTC
This is probably a dup of bug 197915.  Rudolf, what do you think?
Comment 2 rudolf.hornig 2009-07-28 11:34:28 UTC
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.
Comment 3 Tom Hughes 2009-07-28 11:41:00 UTC

*** This bug has been marked as a duplicate of bug 197915 ***