[libcxx-commits] [libcxx] [libcxx] Improve libcxx tests when using Optimizations. (PR #88897)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 26 06:50:44 PDT 2024


================
@@ -51,7 +51,8 @@ int main(int, char**) {
     // Test with an overaligned type
     {
         new_called = delete_called = 0;
-        OverAligned* x = DoNotOptimize(new OverAligned[3]);
+        OverAligned* dummy_data_block = new OverAligned[3];
----------------
ldionne wrote:

Do you really still see the bug if you change all of those back to `OverAligned* x = DoNotOptimize(new ...)`?

It seems to me that the only necessary part of this patch is adding the missing `DoNotOptimize` calls in `libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align_nothrow.replace.pass.cpp`, `libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new.size_align.replace.pass.cpp` and `libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new.size_align.replace.pass.cpp`.

https://github.com/llvm/llvm-project/pull/88897


More information about the libcxx-commits mailing list