提问人:Piotr Siupa 提问时间:2/10/2023 更新时间:2/10/2023 访问量:67
std::isinf 在使用 valgrind 运行时程序不起作用
std::isinf doesn't work when the program is run with valgrind
问:
我有这个简单的程序:
test.cc
:
#include <limits>
#include <iostream>
#include <cmath>
int main() {
std::cout << (std::isinf(std::numeric_limits<long double>::infinity()) ? "true" : "false") << std::endl;
}
当我正常运行时,结果符合预期:
g++ -std=c++17 -Wall -Wextra -pedantic -O0 -g3 test.cc && ./a.out
:
true
但是,当我使用 valgrind 运行它时,它会打印 .false
g++ -std=c++17 -Wall -Wextra -pedantic -O0 -g3 test.cc && valgrind --leak-check=full -- ./a.out
:
==2680== Memcheck, a memory error detector
==2680== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2680== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==2680== Command: ./a.out
==2680==
false
==2680==
==2680== HEAP SUMMARY:
==2680== in use at exit: 0 bytes in 0 blocks
==2680== total heap usage: 2 allocs, 2 frees, 73,728 bytes allocated
==2680==
==2680== All heap blocks were freed -- no leaks are possible
==2680==
==2680== For lists of detected and suppressed errors, rerun with: -s
==2680== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
为什么会这样?
(我使用“g++ (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0”和“valgrind-3.15.0”。
答: 暂无答案
评论
-fsanitize
long double
-mlong-double-64