Files
clang-p2996/compiler-rt/test/asan/TestCases/init-order-atexit.cpp
Alvin Wong 5888a47914 [asan][test] Fix tests or mark XFAIL for MinGW target
After this change, `check-asan-dynamic` should pass on x86_64 MinGW
target, using the llvm-mingw toolchain.

The following is a list of issues fixed:

* `asan_str_test.cpp`: Exclude unintercepted functions on MinGW.
* `asan_test.cpp`: Work around regex limitation of gtest on Windows,
  which only affects MinGW target because `long double` has different
  size to `double`.
* `TestCases/Windows/report_after_syminitialize.cpp`: Added  build
  command specifically for MinGW.
* Other tests: Mark XFAIL for various reasons. Some of them need
  further investigation.

Differential Revision: https://reviews.llvm.org/D147059
2023-04-02 01:06:15 +08:00

35 lines
736 B
C++

// Test for the following situation:
// (1) global A is constructed.
// (2) exit() is called during construction of global B.
// (3) destructor of A reads uninitialized global C from another module.
// We do *not* want to report init-order bug in this case.
// RUN: %clangxx_asan -O0 %s %p/Helpers/init-order-atexit-extra.cpp -o %t
// RUN: %env_asan_opts=strict_init_order=true not %run %t 2>&1 | FileCheck %s
// FIXME: Investigate failure on MinGW
// XFAIL: target={{.*-windows-gnu}}
#include <stdio.h>
#include <stdlib.h>
void AccessC();
class A {
public:
A() { }
~A() { AccessC(); printf("PASSED\n"); }
// CHECK-NOT: AddressSanitizer
// CHECK: PASSED
};
A a;
class B {
public:
B() { exit(1); }
~B() { }
};
B b;