Oh, I have another idea: could it be that you're also turning some optimization on when UBSan is enabled? Note that the operator new/operator delete pair is elidable in each of these tests, and Clang will remove the calls when compiling with optimizations enabled.
That's it. The UBSAN tests build w/ -O2. /Eric On Fri, Oct 14, 2016 at 4:18 PM, Richard Smith <rich...@metafoo.co.uk> wrote: > Oh, I have another idea: could it be that you're also turning some > optimization on when UBSan is enabled? Note that the operator new/operator > delete pair is elidable in each of these tests, and Clang will remove the > calls when compiling with optimizations enabled. > > On Fri, Oct 14, 2016 at 2:38 PM, Eric Fiselier via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> UBSAN may not be replacing the function, but it is doing something weird >> at the codegen level. I looked into this a while ago but never sorted it >> out. >> >> Either way I'll clarify the comments and add the missing reset() calls. >> Unfortunately the tests still fail in the same way. >> >> On Fri, Oct 14, 2016 at 11:49 AM, Richard Smith <rich...@metafoo.co.uk> >> wrote: >> >>> On Fri, Oct 14, 2016 at 12:49 AM, Eric Fiselier via cfe-commits < >>> cfe-commits@lists.llvm.org> wrote: >>> >>>> Author: ericwf >>>> Date: Fri Oct 14 02:49:15 2016 >>>> New Revision: 284210 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=284210&view=rev >>>> Log: >>>> XFAIL aligned allocation test failures with UBSAN >>>> >>>> Modified: >>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp >>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp >>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.single/delete_align_val_t_replace.pass.cpp >>>> libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp >>>> >>>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la >>>> nguage.support/support.dynamic/new.delete/new.delete.array/d >>>> elete_align_val_t_replace.pass.cpp?rev=284210&r1=284209&r2=2 >>>> 84210&view=diff >>>> ============================================================ >>>> ================== >>>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp (original) >>>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.array/delete_align_val_t_replace.pass.cpp Fri Oct 14 >>>> 02:49:15 2016 >>>> @@ -17,6 +17,9 @@ >>>> // None of the current GCC compilers support this. >>>> // XFAIL: gcc-4, gcc-5, gcc-6 >>>> >>>> +// UBSAN replaces certain new/delete functions which makes this test >>>> fail >>>> >>> >>> I don't think that's the problem; the UBSan runtime doesn't replace any >>> functions. Instead... >>> >>> >>>> +// XFAIL: ubsan >>>> + >>>> #include <new> >>>> #include <cstddef> >>>> #include <cstdlib> >>>> @@ -58,24 +61,24 @@ struct alignas(std::max_align_t) B {}; >>>> int main() >>>> { >>>> >>> >>> I think you're missing a call to reset() here. It looks like the >>> sanitizer runtimes happen to call 'operator new' before entering main. >>> >>> >>>> { >>>> - B *x = new B; >>>> + B *x = new B[2]; >>>> assert(0 == unsized_delete_called); >>>> assert(0 == unsized_delete_nothrow_called); >>>> assert(0 == aligned_delete_called); >>>> >>>> - delete x; >>>> + delete [] x; >>>> assert(1 == unsized_delete_called); >>>> assert(0 == unsized_delete_nothrow_called); >>>> assert(0 == aligned_delete_called); >>>> } >>>> reset(); >>>> { >>>> - A *x = new A; >>>> + A *x = new A[2]; >>>> assert(0 == unsized_delete_called); >>>> assert(0 == unsized_delete_nothrow_called); >>>> assert(0 == aligned_delete_called); >>>> >>>> - delete x; >>>> + delete [] x; >>>> assert(0 == unsized_delete_called); >>>> assert(0 == unsized_delete_nothrow_called); >>>> assert(1 == aligned_delete_called); >>>> >>>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la >>>> nguage.support/support.dynamic/new.delete/new.delete.array/n >>>> ew_align_val_t_nothrow_replace.pass.cpp?rev=284210&r1=284209 >>>> &r2=284210&view=diff >>>> ============================================================ >>>> ================== >>>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp >>>> (original) >>>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp Fri >>>> Oct 14 02:49:15 2016 >>>> @@ -13,9 +13,6 @@ >>>> >>>> // UNSUPPORTED: sanitizer-new-delete >>>> >>>> -// TODO Investigate why UBSAN prevents nothrow new from calling our >>>> replacement. >>>> -// XFAIL: ubsan >>>> - >>>> #include <new> >>>> #include <cstddef> >>>> #include <cstdlib> >>>> >>>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.single/delete_align_val_t_replace.pass.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la >>>> nguage.support/support.dynamic/new.delete/new.delete.single/ >>>> delete_align_val_t_replace.pass.cpp?rev=284210&r1=284209&r2= >>>> 284210&view=diff >>>> ============================================================ >>>> ================== >>>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.single/delete_align_val_t_replace.pass.cpp (original) >>>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.single/delete_align_val_t_replace.pass.cpp Fri Oct 14 >>>> 02:49:15 2016 >>>> @@ -17,6 +17,9 @@ >>>> // None of the current GCC compilers support this. >>>> // XFAIL: gcc-4, gcc-5, gcc-6 >>>> >>>> +// UBSAN replaces certain new/delete functions which makes this test >>>> fail >>>> +// XFAIL: ubsan >>>> + >>>> #include <new> >>>> #include <cstddef> >>>> #include <cstdlib> >>>> >>>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la >>>> nguage.support/support.dynamic/new.delete/new.delete.single/ >>>> new_align_val_t_nothrow_replace.pass.cpp?rev=284210&r1=28420 >>>> 9&r2=284210&view=diff >>>> ============================================================ >>>> ================== >>>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp >>>> (original) >>>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.d >>>> elete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp Fri >>>> Oct 14 02:49:15 2016 >>>> @@ -13,8 +13,6 @@ >>>> >>>> // UNSUPPORTED: sanitizer-new-delete >>>> >>>> -// TODO Investigate why UBSAN prevents nothrow new from calling our >>>> replacement. >>>> -// XFAIL: ubsan >>>> >>>> #include <new> >>>> #include <cstddef> >>>> >>>> >>>> _______________________________________________ >>>> cfe-commits mailing list >>>> cfe-commits@lists.llvm.org >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>>> >>> >>> >> >> _______________________________________________ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> >> >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits