From: Martin Storsjö Date: Sun, 9 Jan 2022 22:32:47 +0000 (+0000) Subject: [libcxx] [test] Fix mismatches between _aligned_malloc and free() on Windows X-Git-Tag: upstream/15.0.7~19111 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2aea7199a5c99260d27ee37f3cda8f752478c02;p=platform%2Fupstream%2Fllvm.git [libcxx] [test] Fix mismatches between _aligned_malloc and free() on Windows This allows getting rid of one case of LIBCXX-WINDOWS-FIXME. The fixme comment was inaccurate; aligned allocation functions are provided these days, but the test kept failing as it was using mismatched allocation and free functions. A similar issue was fixed earlier, in 6596778b46ba69517191e7397289228168064ff4. That test was fixed by overriding the aligned `operator new` too, and returning a dummy fixed allocation instead. As this test is libcxx specific, it can use the internal `std::__libcpp_aligned_free()` instead, to match libcxx's internal aligned `operator new`. Differential Revision: https://reviews.llvm.org/D118190 --- diff --git a/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp b/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp index 1f663e0..a90eaf2 100644 --- a/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp +++ b/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp @@ -9,10 +9,6 @@ // test libc++'s implementation of align_val_t, and the relevant new/delete // overloads in all dialects when -faligned-allocation is present. -// Libc++ defers to the underlying MSVC library to provide the new/delete -// definitions, which does not yet provide aligned allocation -// XFAIL: LIBCXX-WINDOWS-FIXME - // XFAIL: LIBCXX-AIX-FIXME // The dylibs shipped before macosx10.13 do not contain the aligned allocation @@ -115,14 +111,14 @@ void operator delete(void* p, size_t n)TEST_NOEXCEPT { #ifndef NO_ALIGN void operator delete(void* p, std::align_val_t a)TEST_NOEXCEPT { - ::free(p); + std::__libcpp_aligned_free(p); stats.aligned_called++; stats.last_align = static_cast(a); stats.last_size = -1; } void operator delete(void* p, size_t n, std::align_val_t a)TEST_NOEXCEPT { - ::free(p); + std::__libcpp_aligned_free(p); stats.aligned_sized_called++; stats.last_align = static_cast(a); stats.last_size = n;