[compiler-rt] [compiler-rt][nsan] Add support for nan detection (PR #101531)
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 25 21:19:20 PDT 2024
MatzeB wrote:
Hi, I believe this change (after re-applied in 51365212362c4d0e32a0c747ab85bbf3919944b8 ) fails our builds using gcc 11.x:
```
/home/engshare/third-party2/gcc/11.x/centos9-native/886b5eb/bin/g++ -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/engshare/third-party2/llvm-fb/17/src/build-platform010/pic/projects/compiler-rt/lib/nsan -I/home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan -I/home/engshare/third-party2/llvm-fb/17/src/build-platform010/pic/include -I/home/engshare/third-party2/llvm-fb/17/src/llvm-project/llvm/include -I/home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/.. -O3 -g -pipe -Wall -Wno-error -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fno-omit-frame-pointer -momit-leaf-frame-pointer -fno-reorder-blocks-and-partition -gz=none -Wl,-z,relro -fcommon -gdwarf-4 -gstrict-dwarf -march=corei7 -mtune=skylake -nostdinc -grecord-gcc-switches -fdebug-prefix-map=/home/engshare/third-party2/llvm-fb/17/src/llvm-project=/home/engshare/third-party2/llvm-fb/17/src/llvm-project -fdebug-prefix-map=/home/engshare/third-party2/llvm-fb/17/src/build-platform010/pic=/home/engshare/third-party2/llvm-fb/17/src/llvm-project -isystem/home/engshare/third-party2/libedit/3.1/platform010/6e03f73/include -isystem/home/engshare/third-party2/zlib/1.2.8/platform010/76ebdda/include -isystem/home/engshare/third-party2/ncurses/6.1/platform010/76ebdda/include -isystem/home/engshare/third-party2/xz/5.2.2/platform010/76ebdda/include -isystem/home/engshare/third-party2/readline/8.0/platform010/6e03f73/include -isystem/home/engshare/third-party2/gdbm/1.11/platform010/76ebdda/include -isystem/home/engshare/third-party2/binutils/2.37/platform010/64091f4/include -isystem/home/engshare/third-party2/openssl/1.1.1/platform010/76ebdda/include -isystem/home/engshare/third-party2/sqlite/3.36/platform010/9079c97/include -isystem/home/engshare/third-party2/python/3.10/platform010/9168809/include -isystem/home/engshare/third-party2/libffi/3.2.1/platform010/76ebdda/lib/libffi-3.2.1/include -isystem/home/engshare/third-party2/jemalloc/master/platform010/779a252/include -isystem/home/engshare/third-party2/libuuid/1.0.2/platform010/76ebdda/include -isystem/home/engshare/third-party2/libxml2/2.9.9/platform010/ec4b15a/include -isystem/home/engshare/third-party2/libxml2/2.9.9/platform010/ec4b15a/include/libxml2 -isystem/home/engshare/third-party2/grpc/1.42.0/platform010/92e86c7/include -isystem/home/engshare/third-party2/bzip2/1.0.6/platform010/76ebdda/include -isystem/home/engshare/third-party2/libunwind/1.8/platform010/76ebdda/include -isystem/home/engshare/third-party2/libzip/1.5.1/platform010/6ace573/include -isystem/home/engshare/third-party2/benchmark/trunk/platform010/76ebdda/include -isystem/home/engshare/third-party2/re2/20190601/platform010/76ebdda/include -isystem/home/engshare/third-party2/gflags/2.2.0/platform010/76ebdda/include -isystem/home/engshare/third-party2/c-ares/1.13.0/platform010/76ebdda/include -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wno-unused-parameter -O2 -g -DNDEBUG -std=c++17 -fvisibility=default -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -nostdinc++ -fno-rtti -MD -MT projects/compiler-rt/lib/nsan/CMakeFiles/RTNsan.x86_64.dir/nsan.cpp.o -MF projects/compiler-rt/lib/nsan/CMakeFiles/RTNsan.x86_64.dir/nsan.cpp.o.d -o projects/compiler-rt/lib/nsan/CMakeFiles/RTNsan.x86_64.dir/nsan.cpp.o -c /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan.cpp
In file included from /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/../sanitizer_common/sanitizer_linux.h:22,
from /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/../sanitizer_common/sanitizer_procmaps.h:25,
from /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/../sanitizer_common/sanitizer_allocator.h:24,
from /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/../sanitizer_common/sanitizer_allocator_internal.h:16,
from /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/../sanitizer_common/sanitizer_addrhashmap.h:19,
from /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan_stats.h:19,
from /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan.cpp:35:
/home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/../sanitizer_common/sanitizer_platform_limits_posix.h:593:10: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
593 | struct {
| ^
/home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan.cpp: In function 'void __nsan_dump_shadow_mem(const u8*, size_t, size_t, size_t)':
/home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan.cpp:359:23: warning: cast from type 'const u8*' {aka 'const unsigned char*'} to type 'void*' casts away qualifiers [-Wcast-qual]
359 | printf("%p: ", (void *)(addr + R * bytes_per_line));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan.cpp: In instantiation of 'int32_t checkFT(FT, ShadowFT, __nsan::CheckTypeT, __sanitizer::uptr) [with FT = double; ShadowFT = __float128; int32_t = int; __sanitizer::uptr = long unsigned int]':
/home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan.cpp:605:17: required from here
/home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan.cpp:449:33: error: call of overloaded 'isnan(const InternalFT&)' is ambiguous
449 | if (flags().check_nan && isnan(check_value)) {
| ~~~~~^~~~~~~~~~~~~
In file included from /home/engshare/third-party2/libgcc/11.x/platform010/5684a5a/include/c++/11.x/math.h:36,
from /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan.h:29,
from /home/engshare/third-party2/llvm-fb/17/src/llvm-project/compiler-rt/lib/nsan/nsan.cpp:33:
/home/engshare/third-party2/libgcc/11.x/platform010/5684a5a/include/c++/11.x/cmath:624:3: note: candidate: 'constexpr bool std::isnan(long double)'
624 | isnan(long double __x)
| ^~~~~
/home/engshare/third-party2/libgcc/11.x/platform010/5684a5a/include/c++/11.x/cmath:619:3: note: candidate: 'constexpr bool std::isnan(double)'
619 | isnan(double __x)
| ^~~~~
/home/engshare/third-party2/libgcc/11.x/platform010/5684a5a/include/c++/11.x/cmath:611:3: note: candidate: 'constexpr bool std::isnan(float)'
611 | isnan(float __x)
| ^~~~~
```
could you take a look?
https://github.com/llvm/llvm-project/pull/101531
More information about the llvm-commits
mailing list