brintos

brintos / llvm-project-archived public Read only

0
0
Text · 736 B · 6877076 Raw
35 lines · cpp
1// Test for the following situation:2// (1) global A is constructed.3// (2) exit() is called during construction of global B.4// (3) destructor of A reads uninitialized global C from another module.5// We do *not* want to report init-order bug in this case.6 7// RUN: %clangxx_asan -O0 %s %p/Helpers/init-order-atexit-extra.cpp -o %t8// RUN: %env_asan_opts=strict_init_order=true not %run %t 2>&1 | FileCheck %s9 10// FIXME: Investigate failure on MinGW11// XFAIL: target={{.*-windows-gnu}}12 13#include <stdio.h>14#include <stdlib.h>15 16void AccessC();17 18class A {19 public:20  A() { }21  ~A() { AccessC(); printf("PASSED\n"); }22  // CHECK-NOT: AddressSanitizer23  // CHECK: PASSED24};25 26A a;27 28class B {29 public:30  B() { exit(1); }31  ~B() { }32};33 34B b;35