[compiler-rt] r276332 - [asan] Fix Win64 test portability issues

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 14:45:34 PDT 2016


this breaks the linix build:

In file included from
/usr/local/google/home/kcc/llvm/projects/compiler-rt/test/asan/TestCases/use-after-scope-capture.cc:4:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/functional:55:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/tuple:39:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/array:38:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/stdexcept:39:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/string:52:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/basic_string.h:2815:
In file included from
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/ext/string_conversions.h:43:
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/cstdio:120:11:
error: no member named 'gets' in the global namespace
  using ::gets;
        ~~^
1 error generated.


On Thu, Jul 21, 2016 at 2:04 PM, Reid Kleckner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rnk
> Date: Thu Jul 21 16:04:34 2016
> New Revision: 276332
>
> URL: http://llvm.org/viewvc/llvm-project?rev=276332&view=rev
> Log:
> [asan] Fix Win64 test portability issues
>
> The OOM test should really only run on 32-bits, since it's hard to OOM
> on x64.
>
> The operator_array_new_with_dtor_left_oob tests need to account for the
> larger array cookie on x64 (8 bytes instead of 4).
>
> Use -std=c++14 in use-after-scope-capture.cc to avoid errors in the MSVC
> 2015 STL on Windows. The default there is C++14 anyway.
>
> Modified:
>
> compiler-rt/trunk/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc
>     compiler-rt/trunk/test/asan/TestCases/Windows/oom.cc
>
> compiler-rt/trunk/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc
>     compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc
>
> Modified:
> compiler-rt/trunk/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc?rev=276332&r1=276331&r2=276332&view=diff
>
> ==============================================================================
> ---
> compiler-rt/trunk/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc
> (original)
> +++
> compiler-rt/trunk/test/asan/TestCases/Windows/dll_operator_array_new_with_dtor_left_oob.cc
> Thu Jul 21 16:04:34 2016
> @@ -10,7 +10,7 @@ struct C {
>  extern "C" __declspec(dllexport)
>  int test_function() {
>    C *buffer = new C[42];
> -  buffer[-2].x = 42;
> +  buffer[-(1 + sizeof(void*) / 4)].x = 42;
>  // CHECK: AddressSanitizer: heap-buffer-overflow on address
> [[ADDR:0x[0-9a-f]+]]
>  // CHECK: WRITE of size 4 at [[ADDR]] thread T0
>  // CHECK-NEXT: test_function
> {{.*}}dll_operator_array_new_with_dtor_left_oob.cc:[[@LINE-3]]
> @@ -19,7 +19,7 @@ int test_function() {
>  // FIXME: Currently it says "4 bytes ... left of 172-byte region",
>  //        should be "8 bytes ... left of 168-byte region", see
>  //
> https://code.google.com/p/address-sanitizer/issues/detail?id=314
> -// CHECK: [[ADDR]] is located {{.*}} bytes to the left of 172-byte region
> +// CHECK: [[ADDR]] is located {{.*}} bytes to the left of
> {{(172|176)}}-byte region
>  // FIXME: Should get rid of the malloc/free frames called from the inside
> of
>  // operator new/delete in DLLs when using -MT CRT.
>  // FIXME: The operator new frame should have [].
>
> Modified: compiler-rt/trunk/test/asan/TestCases/Windows/oom.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/oom.cc?rev=276332&r1=276331&r2=276332&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/test/asan/TestCases/Windows/oom.cc (original)
> +++ compiler-rt/trunk/test/asan/TestCases/Windows/oom.cc Thu Jul 21
> 16:04:34 2016
> @@ -1,5 +1,6 @@
>  // RUN: %clang_cl_asan -O0 %s -Fe%t
>  // RUN: not %run %t 2>&1 | FileCheck %s
> +// REQUIRES: asan-32-bits
>
>  #include <malloc.h>
>
>
> Modified:
> compiler-rt/trunk/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc?rev=276332&r1=276331&r2=276332&view=diff
>
> ==============================================================================
> ---
> compiler-rt/trunk/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc
> (original)
> +++
> compiler-rt/trunk/test/asan/TestCases/Windows/operator_array_new_with_dtor_left_oob.cc
> Thu Jul 21 16:04:34 2016
> @@ -8,7 +8,7 @@ struct C {
>
>  int main() {
>    C *buffer = new C[42];
> -  buffer[-2].x = 42;
> +  buffer[-(1 + sizeof(void*) / 4)].x = 42;
>  // CHECK: AddressSanitizer: heap-buffer-overflow on address
> [[ADDR:0x[0-9a-f]+]]
>  // CHECK: WRITE of size 4 at [[ADDR]] thread T0
>  // CHECK-NEXT: {{#0 .* main
> .*operator_array_new_with_dtor_left_oob.cc}}:[[@LINE-3]]
> @@ -16,7 +16,7 @@ int main() {
>  // FIXME: Currently it says "4 bytes ... left of 172-byte region",
>  //        should be "8 bytes ... left of 168-byte region", see
>  //
> https://code.google.com/p/address-sanitizer/issues/detail?id=314
> -// CHECK: [[ADDR]] is located {{.*}} bytes to the left of 172-byte region
> +// CHECK: [[ADDR]] is located {{.*}} bytes to the left of
> {{(172|176)}}-byte region
>  // CHECK-LABEL: allocated by thread T0 here:
>  // FIXME: The 'operator new' frame should have [].
>  // CHECK-NEXT: {{#0 .* operator new}}
>
> Modified: compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc?rev=276332&r1=276331&r2=276332&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc
> (original)
> +++ compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc Thu
> Jul 21 16:04:34 2016
> @@ -1,4 +1,4 @@
> -// RUN: %clangxx_asan -std=c++11 -O1 -fsanitize-address-use-after-scope
> %s -o %t && \
> +// RUN: %clangxx_asan -std=c++14 -O1 -fsanitize-address-use-after-scope
> %s -o %t && \
>  // RUN:     not %run %t 2>&1 | FileCheck %s
>
>  #include <functional>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160721/bf1374b8/attachment.html>


More information about the llvm-commits mailing list