<div dir="ltr">Ouch, I am sorry. <div>May I ask you to apply a fix (I am running home and have no Windows box handy to test anyway).</div><div><br></div><div>Most likely, you need to add atomic_fetch_add/atomic_fetch_sub for atomic_uintptr_t, </div>
<div>just duplicate two corresponding  functions around sanitizer_common/sanitizer_atomic_msvc.h (line 104)</div><div><br></div><div>--kcc </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 14, 2014 at 9:41 AM, Hans Wennborg <span dir="ltr"><<a href="mailto:hans@chromium.org" target="_blank">hans@chromium.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Kostya,<br>
<div class=""><br>
On Mon, Apr 14, 2014 at 7:51 AM, Kostya Serebryany <<a href="mailto:kcc@google.com">kcc@google.com</a>> wrote:<br>
> Author: kcc<br>
> Date: Mon Apr 14 09:51:01 2014<br>
> New Revision: 206178<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=206178&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=206178&view=rev</a><br>
> Log:<br>
> [asan] added internal flag mmap_limit_mb<br>
><br>
<br>
</div>[...]<br>
<div class=""><br>
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc (original)<br>
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc Mon Apr 14 09:51:01 2014<br>
> @@ -244,6 +244,24 @@ char *StripModuleName(const char *module<br>
>    return internal_strdup(short_module_name);<br>
>  }<br>
><br>
> +static atomic_uintptr_t g_total_mmaped;<br>
> +<br>
> +void IncreaseTotalMmap(uptr size) {<br>
> +  if (!common_flags()->mmap_limit_mb) return;<br>
> +  uptr total_mmaped =<br>
> +      atomic_fetch_add(&g_total_mmaped, size, memory_order_relaxed) + size;<br>
<br>
</div>I'm getting a build error here with MSVC:<br>
<br>
E:\b\build\slave\Chromium_Win_Clang\build\src\third_party\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_common.cc(252)<br>
: error C2664: '__sanitizer::u32<br>
__sanitizer::atomic_fetch_add(volatile __sanitizer::atomic_uint32_t<br>
*,__sanitizer::u32,__sanitizer::memory_order)' : cannot convert<br>
argument 1 from '__sanitizer::atomic_uintptr_t *' to 'volatile<br>
__sanitizer::atomic_uint32_t *'<br>
<br>
<br>
<br>
        Types pointed to are unrelated; conversion requires<br>
reinterpret_cast, C-style cast or function-style cast<br>
<div class=""><br>
<br>
> +  if ((total_mmaped >> 20) > common_flags()->mmap_limit_mb) {<br>
> +    // Since for now mmap_limit_mb is not a user-facing flag, just CHECK.<br>
> +    common_flags()->mmap_limit_mb = 0;  // Allow mmap in CHECK.<br>
> +    CHECK_LT(total_mmaped >> 20, common_flags()->mmap_limit_mb);<br>
> +  }<br>
> +}<br>
> +<br>
> +void DecreaseTotalMmap(uptr size) {<br>
> +  if (!common_flags()->mmap_limit_mb) return;<br>
> +  atomic_fetch_sub(&g_total_mmaped, size, memory_order_relaxed);<br>
<br>
</div>And:<br>
<br>
E:\b\build\slave\Chromium_Win_Clang\build\src\third_party\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_common.cc(262)<br>
: error C2664: '__sanitizer::u32<br>
__sanitizer::atomic_fetch_sub(volatile __sanitizer::atomic_uint32_t<br>
*,__sanitizer::u32,__sanitizer::memory_order)' : cannot convert<br>
argument 1 from '__sanitizer::atomic_uintptr_t *' to 'volatile<br>
__sanitizer::atomic_uint32_t *'<br>
<br>
<br>
<br>
        Types pointed to are unrelated; conversion requires<br>
reinterpret_cast, C-style cast or function-style cast<br>
</blockquote></div><br></div>