From: Brad B. <bra...@se...> - 2012-07-30 14:20:18
|
When I run the attached script I get the following output: [bradbell@brad-home trash]$ ./valgrind_tan_bug.sh mkdir valgrind_bug cd valgrind_bug cat valgrind_bug.cpp # include <limits> # include <cmath> # include <iostream> int main(void) { float x = std::numeric_limits<float>::max() / float(2); std::cout << "x = " << std::endl; std::cout << "std::tan(x) = " << std::tan(x) << std::endl; return 0; } g++ valgrind_bug.cpp -o valgrind_bug -g -Wall -ansi -pedantic-errors -std=c++98 -Wshadow ./valgrind_bug x = std::tan(x) = 1.24272 valgrind ./valgrind_bug ==8289== Memcheck, a memory error detector ==8289== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==8289== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==8289== Command: ./valgrind_bug ==8289== x = std::tan(x) = nan ==8289== ==8289== HEAP SUMMARY: ==8289== in use at exit: 0 bytes in 0 blocks ==8289== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==8289== ==8289== All heap blocks were freed -- no leaks are possible ==8289== ==8289== For counts of detected and suppressed errors, rerun with: -v ==8289== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 15 from 8) Note: value of tan(x) is different when run with valgrind uname -a Linux brad-home.localdomain 2.6.43.8-1.fc15.i686 #1 SMP Mon Jun 4 20:28:56 UTC 2012 i686 i686 i386 GNU/Linux valgrind --version valgrind-3.6.1 g++ --version g++ (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9) Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [bradbell@brad-home trash]$ |