[libcxx] r284210 - XFAIL aligned allocation test failures with UBSAN

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 14 14:38:42 PDT 2016


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 <richard at metafoo.co.uk>
wrote:

> On Fri, Oct 14, 2016 at 12:49 AM, Eric Fiselier via cfe-commits <
> cfe-commits at 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.
>> delete/new.delete.array/delete_align_val_t_replace.pass.cpp
>>     libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>>     libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/delete_align_val_t_replace.pass.cpp
>>     libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
>>
>> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/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/
>> delete_align_val_t_replace.pass.cpp?rev=284210&r1=284209&
>> r2=284210&view=diff
>> ============================================================
>> ==================
>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/delete_align_val_t_replace.pass.cpp (original)
>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/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.
>> delete/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/
>> new_align_val_t_nothrow_replace.pass.cpp?rev=284210&r1=
>> 284209&r2=284210&view=diff
>> ============================================================
>> ==================
>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
>> (original)
>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/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.
>> delete/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.
>> delete/new.delete.single/delete_align_val_t_replace.pass.cpp (original)
>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/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.
>> delete/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=284209&r2=284210&view=diff
>> ============================================================
>> ==================
>> --- libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
>> (original)
>> +++ libcxx/trunk/test/std/language.support/support.dynamic/new.
>> delete/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 at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161014/a94760c5/attachment-0001.html>


More information about the cfe-commits mailing list