[llvm-bugs] [Bug 40320] New: Asan error: SEH exception with code 0xc000001d thrown in the test body.
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 15 08:26:06 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40320
Bug ID: 40320
Summary: Asan error: SEH exception with code 0xc000001d thrown
in the test body.
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Driver
Assignee: unassignedclangbugs at nondot.org
Reporter: steveire at gmail.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Clang-CL can build the assimp libraries (https://github.com/assimp/assimp.git)
and the tests pass.
However, when asan is enabled, several tests no longer pass.
This patch enables asan on windows for assimp:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 645d9268..52e52815 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,31 @@ SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >=
2.8.4 is required
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
PROJECT( Assimp )
+set(LLVM_PREFIX "c:/Program Files/LLVM/lib/clang/7.0.0/lib/windows")
+
+add_library(clang::AddressSanitizerDynamicRuntime INTERFACE IMPORTED)
+set_property(TARGET clang::AddressSanitizerDynamicRuntime PROPERTY
+ INTERFACE_LINK_LIBRARIES
+ "${LLVM_PREFIX}/clang_rt.asan_dynamic-x86_64.lib"
+ "${LLVM_PREFIX}/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib"
+ # TODO: x86 add a leading underscore
+ # "-include:___asan_seh_interceptor"
+ "-include:__asan_seh_interceptor"
+
-wholearchive:"${LLVM_PREFIX}/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib"
+ )
+
+add_library(clang::AddressSanitizer INTERFACE IMPORTED)
+
+set_property(TARGET clang::AddressSanitizer PROPERTY
+ INTERFACE_COMPILE_OPTIONS -fsanitize=address
+ )
+set_property(TARGET clang::AddressSanitizer PROPERTY
+ INTERFACE_LINK_LIBRARIES
+ clang::AddressSanitizerDynamicRuntime
+ )
+
+# add_compile_options(-Wno-pragma-pack -Wno-unused-command-line-argument
-Wno-deprecated-declarations)
+
# All supported options ###############################################
OPTION( BUILD_SHARED_LIBS
diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
index e2946716..1e21e2b5 100644
--- a/code/CMakeLists.txt
+++ b/code/CMakeLists.txt
@@ -44,7 +44,6 @@
# 3) Add libassimp using the file lists (eliminates duplication of file names
between
# source groups and library command)
#
-cmake_minimum_required( VERSION 2.6 )
SET( HEADER_PATH ../include/assimp )
SET( COMPILER_HEADERS
@@ -922,6 +921,10 @@ IF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
ENDIF (ASSIMP_BUILD_NONFREE_C4D_IMPORTER)
ADD_LIBRARY( assimp ${assimp_src} )
+target_link_libraries(assimp
+ clang::AddressSanitizer
+ )
+
ADD_LIBRARY(assimp::assimp ALIAS assimp)
TARGET_INCLUDE_DIRECTORIES ( assimp PUBLIC
diff --git a/contrib/zlib/CMakeLists.txt b/contrib/zlib/CMakeLists.txt
index 5f1368ad..138d444a 100644
--- a/contrib/zlib/CMakeLists.txt
+++ b/contrib/zlib/CMakeLists.txt
@@ -191,6 +191,10 @@ if(MINGW)
endif(MINGW)
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS}
${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
+target_link_libraries(zlib
+ clang::AddressSanitizer
+ )
+
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS}
${ZLIB_PRIVATE_HDRS})
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 82d320be..95ea1613 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -179,6 +179,9 @@ add_executable( unit
${MATH}
${POST_PROCESSES}
)
+target_link_libraries(unit PRIVATE
+ clang::AddressSanitizer
+ )
add_definitions(-DASSIMP_TEST_MODELS_DIR="${CMAKE_CURRENT_LIST_DIR}/models")
add_definitions(-DASSIMP_TEST_MODELS_NONBSD_DIR="${CMAKE_CURRENT_LIST_DIR}/models-nonbsd")
diff --git a/tools/assimp_cmd/CMakeLists.txt b/tools/assimp_cmd/CMakeLists.txt
index ae38b5f1..9406fe94 100644
--- a/tools/assimp_cmd/CMakeLists.txt
+++ b/tools/assimp_cmd/CMakeLists.txt
@@ -58,6 +58,9 @@ ADD_EXECUTABLE( assimp_cmd
Info.cpp
Export.cpp
)
+target_link_libraries(assimp_cmd
+ clang::AddressSanitizer
+ )
SET_PROPERTY(TARGET assimp_cmd PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
$ test\unit.exe --gtest_filter=*.importBinaryglTF2FromFileTest
Note: Google Test filter = *.importBinaryglTF2FromFileTest
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from utglTF2ImportExport
[ RUN ] utglTF2ImportExport.importBinaryglTF2FromFileTest
unknown file: error: SEH exception with code 0xc000001d thrown in the test
body.
[ FAILED ] utglTF2ImportExport.importBinaryglTF2FromFileTest (3 ms)
[----------] 1 test from utglTF2ImportExport (3 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (5 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] utglTF2ImportExport.importBinaryglTF2FromFileTest
In total 9 tests fail:
[ FAILED ] 9 tests, listed below:
[ FAILED ] utglTF2ImportExport.importBinaryglTF2FromFileTest
[ FAILED ] utIFCImportExport.importComplextypeAsColor
[ FAILED ] ImporterTest.testPluginInterface
[ FAILED ] utSTLImporterExporter.test_with_empty_solid
[ FAILED ] utXImporterExporter.heap_overflow_in_tokenizer
[ FAILED ] utObjImportExport.issue1453_segfault
[ FAILED ] utObjImportExport.homogeneous_coordinates_divide_by_zero_Test
[ FAILED ] utObjImportExport.0based_array_Test
[ FAILED ] utMDCImportExport.importMDCFromFileTest
It is not clear what 'error: SEH exception with code' means.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190115/928ac687/attachment-0001.html>
More information about the llvm-bugs
mailing list