Index: lib/asan/asan_malloc_win.cc =================================================================== --- lib/asan/asan_malloc_win.cc +++ lib/asan/asan_malloc_win.cc @@ -12,6 +12,16 @@ // Windows-specific malloc interception. //===----------------------------------------------------------------------===// +#ifdef __MINGW32__ +// mingw-w64 winnt.h pulls in x86intrin.h, which can pull in mm_malloc.h +// if __STDC_HOSTED__ is defined. mm_malloc.h includes stdlib.h and malloc.h, +// which include conflicting declarations of these functions. Having earlier +// declarations with or without dllimport produces warnings, but if an +// inline function in a header referenced one of the functions, we no longer +// can redeclare them with dllexport below. +#undef __STDC_HOSTED__ +#endif + #include "sanitizer_common/sanitizer_platform.h" #if SANITIZER_WINDOWS #define WIN32_LEAN_AND_MEAN