|
From: Peter v. H. <p.v...@om...> - 2013-09-24 14:10:29
|
Hi, I am developing a set of unit tests, which I would also like to run through valgrind from time to time. On their own the unit tests run absolutely fine, but when I run them through valgrind I get zillions of failed tests. I tracked this down to an overloaded routine (called exp10) which returns a __float128. The prototype is: __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). When exp10 is called with a positive argument, the return value is just fine, e.g. 9 401cdcd6500000000000000000000000 (without valgrind) 9 401cdcd6500000000000000000000000 (with valgrind) This is compiled on an amd64 platform using g++ 4.7.1 and valgrind 3.7.0 (openSUSE 12.2). I also tried openSUSE 12.3 and got the same behavior (this is g++ 4.7.2, valgrind 3.8.1). I am totally mystified by this. Especially the part where positive arguments work fine and negative do not... Is this a valgrind bug? Peter. |