<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">I didn't realize I needed to join the mailing list owo<br></div><div dir="ltr"><div><br></div>I'm attempting to compile the DataFlow Sanitizer example on the clang site (<a href="https://clang.llvm.org/docs/DataFlowSanitizer.html" target="_blank">https://clang.llvm.org/docs/DataFlowSanitizer.html</a>) using clang9 that I compiled from the llvm source.<br><br>However, I'm getting error messages stating several types (defined in stdint.h) aren't defined. I've confirmed they're defined and that the compiler finds them in stdint.h, in my /usr/local/include path.<br><br>To troubleshoot, I also included stdint.h in the source and declared a uint16_t variable, tm, but it still says it doesn't recognize the type.<br>The example program:<br><br> #include <stdint.h><br> #include <sanitizer/dfsan_interface.h><br> #include <assert.h><br><br> int main(void) {<br> uint16_t tm;<br> int i = 1;<br> dfsan_label i_label = dfsan_create_label("i", 0);<br> dfsan_set_label(i_label, &i, sizeof(i));<br> <br> int j = 2;<br> dfsan_label j_label = dfsan_create_label("j", 0);<br> dfsan_set_label(j_label, &j, sizeof(j));<br> <br> int k = 3;<br> dfsan_label k_label = dfsan_create_label("k", 0);<br> dfsan_set_label(k_label, &k, sizeof(k));<br> <br> dfsan_label ij_label = dfsan_get_label(i + j);<br> assert(dfsan_has_label(ij_label, i_label));<br> assert(dfsan_has_label(ij_label, j_label));<br> assert(!dfsan_has_label(ij_label, k_label));<br> <br> dfsan_label ijk_label = dfsan_get_label(i + j + k);<br> assert(dfsan_has_label(ijk_label, i_label));<br> assert(dfsan_has_label(ijk_label, j_label));<br> assert(dfsan_has_label(ijk_label, k_label));<br> <br> return 0;<br> }<br><br>The verbose error messages:<br><br> user@box:~/Desktop/test$ clang -v -fsanitize=dataflow dfsOne.cpp<br> user@box:~/Desktop/test$ clang -v -fsanitize=dataflow dfsOne.cpp<br> clang version 9.0.0 (<a href="https://github.com/llvm/llvm-project.git" target="_blank">https://github.com/llvm/llvm-project.git</a> 2ba0e2518b96392f9f2352d10fc5a27bbbc92fa9)<br> Target: x86_64-unknown-linux-gnu<br> Thread model: posix<br> InstalledDir: /home/user/Desktop/tools/llvm-project/build/bin<br> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5<br> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0<br> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6<br> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0<br> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7<br> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0<br> Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8<br> Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8<br> Candidate multilib: .;@m64<br> Selected multilib: .;@m64<br> "/usr/local/bin/clang-9" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name dfsOne.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/local/lib/clang/9.0.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/backward -internal-isystem /usr/local/include -internal-isystem /usr/local/lib/clang/9.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/user/Desktop/test -ferror-limit 19 -fmessage-length 0 -fsanitize=dataflow -fsanitize-blacklist=/usr/local/lib/clang/9.0.0/share/dfsan_abilist.txt -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /tmp/dfsOne-2ed122.o -x c++ dfsOne.cpp<br> clang -cc1 version 9.0.0 based upon LLVM 9.0.0svn default target x86_64-unknown-linux-gnu<br> ignoring nonexistent directory "/include"<br> ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8"<br> #include "..." search starts here:<br> #include <...> search starts here:<br> /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8<br> /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/x86_64-linux-gnu/c++/8<br> /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/backward<br> /usr/local/include<br> /usr/local/lib/clang/9.0.0/include<br> /usr/include/x86_64-linux-gnu<br> /usr/include<br> End of search list.<br> In file included from dfsOne.cpp:3:<br> In file included from /usr/local/include/sanitizer/dfsan_interface.h:18:<br> /usr/local/include/sanitizer/common_interface_defs.h:33:5: error: unknown type name 'intptr_t'<br> intptr_t coverage_fd;<br> ^<br> /usr/local/include/sanitizer/common_interface_defs.h:60:3: error: unknown type name 'uint16_t'<br> uint16_t __sanitizer_unaligned_load16(const void *p);<br> ^<br> /usr/local/include/sanitizer/common_interface_defs.h:61:3: error: unknown type name 'uint32_t'<br> uint32_t __sanitizer_unaligned_load32(const void *p);<br> ^<br> /usr/local/include/sanitizer/common_interface_defs.h:62:3: error: unknown type name 'uint64_t'<br> uint64_t __sanitizer_unaligned_load64(const void *p);<br> ^<br> /usr/local/include/sanitizer/common_interface_defs.h:63:47: error: unknown type name 'uint16_t'<br> void __sanitizer_unaligned_store16(void *p, uint16_t x);<br> ^<br> /usr/local/include/sanitizer/common_interface_defs.h:64:47: error: unknown type name 'uint32_t'<br> void __sanitizer_unaligned_store32(void *p, uint32_t x);<br> ^<br> /usr/local/include/sanitizer/common_interface_defs.h:65:47: error: unknown type name 'uint64_t'<br> void __sanitizer_unaligned_store64(void *p, uint64_t x);<br> ^<br> In file included from dfsOne.cpp:3:<br> /usr/local/include/sanitizer/dfsan_interface.h:24:9: error: unknown type name 'uint16_t'<br> typedef uint16_t dfsan_label;<br> ^<br> dfsOne.cpp:7:2: error: unknown type name 'uint16_t'<br> uint16_t tm;<br> ^<br> 9 errors generated.<br><br>I've also attempted to build via cmake with the following CmakeLists.txt file (same errors though, I'm using cmake 3.5.1):<br><br> cmake_minimum_required (VERSION 2.6)<br> project (EXAMPLE)<br> add_executable(dfsOne dfsOne.cpp)<br> SET (CMAKE_CXX_STANDARD 11)<br> SET (CMAKE_CXX_STANDARD_REQUIRED ON)<br> SET (CMAKE_C_COMPILER "/home/user/Desktop/tools/llvm-project/build/bin/clang")<br> SET (CMAKE_C_FLAGS "-fsanitize=dataflow")<br><br>Any ideas why the compiler doesn't know the types even though I import stdint.h? <br></div>
</div></div>