Hi John,

When I tried to create a bug report, it gave me an "invalid username" complaint. So I will attach the source file here instead.

Compile with:

g++ valgrindbug.cc -limf -L/path/to/intel/libs

It requires libimf.a, which is part of the Intel C++ or fortran compiler. I used the version from Intel 11.1. If you do not have this compiler, please contact me offline to discuss this further.

When run directly, the output is

3fbc79ca10c9242235d511e976394d7a

When run through valgrind, the output is:

==31657== Memcheck, a memory error detector
==31657== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==31657== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==31657== Command: a.out
==31657==
3fbc79ca10c9240e12445f2000000000
==31657==
==31657== HEAP SUMMARY:
==31657==     in use at exit: 0 bytes in 0 blocks
==31657==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==31657==
==31657== All heap blocks were freed -- no leaks are possible
==31657==
==31657== For counts of detected and suppressed errors, rerun with: -v
==31657== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

% g++ --version
g++ (SUSE Linux) 4.7.1 20120723 [gcc-4_7-branch revision 189773]

Operating system is openSUSE 12.2, as stated below.


Cheers,

Peter.


On 2013-09-24 17:55, John Reiser wrote:
__float128 exp10(__float128);

When that routine is called with a negative argument, the return value
changes when I run the code through valgrind, e.g.

-20 3fbc79ca10c9242235d511e976394d7a (without valgrind)
-20 3fbc79ca10c9240e12445f2000000000 (with valgrind)

The -20 is the argument for exp10() and was obviously converted to
__float128, and the return value is printed here in hex format.
Initially I thought that the lowest 64 bits were mangled, but from this
example you can see that it is a bit more (the lowest 70 bits differ).

This is a bug in memcheck.  Please file a bug report.
Construct a short test case program (15 lines or so)
which reproduces the output above.  Then go to the main page
http://www.valgrind.org/ , click on the Bug Reports link
(left column under Contact), describe the problem (much as above),
copy+paste the output, and attach the test case program.
Please also include the versions of valgrind, compiler, C/math library,
and operating system; and kind of hardware.
Thank you.


--
Peter van Hoof
Royal Observatory of Belgium
Ringlaan 3
1180 Brussel
Belgium
http://homepage.oma.be/pvh
#include <iostream>
#include <iomanip>

using namespace std;

extern "C" {
	__float128 __exp10q(__float128);
}

struct f128 {
	union {
		__float128 f;
		long long x[2];
	};
};

int main()
{
	f128 x, y;
	x.x[0] = 0x0;
	x.x[1] = 0xc003400000000000ULL; // __float128(-20)
	y.f = __exp10q(x.f);
	cout << hex << setfill('0');
	cout << setw(16) << y.x[1] << setw(16) << y.x[0] << endl;
	return 0;
}
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to