Stephen Hines | 6a211c5 | 2014-07-21 00:49:56 -0700 | [diff] [blame] | 1 | // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 |
| 2 | // XFAIL: android |
| 3 | // |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 4 | // Test for the following situation: |
| 5 | // (1) global A is constructed. |
| 6 | // (2) exit() is called during construction of global B. |
| 7 | // (3) destructor of A reads uninitialized global C from another module. |
| 8 | // We do *not* want to report init-order bug in this case. |
| 9 | |
| 10 | // RUN: %clangxx_asan -O0 %s %p/Helpers/init-order-atexit-extra.cc -o %t |
Pirama Arumuga Nainar | cdce50b | 2015-07-01 12:26:56 -0700 | [diff] [blame] | 11 | // RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:strict_init_order=true not %run %t 2>&1 | FileCheck %s |
Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 12 | |
| 13 | #include <stdio.h> |
| 14 | #include <stdlib.h> |
| 15 | |
| 16 | void AccessC(); |
| 17 | |
| 18 | class A { |
| 19 | public: |
| 20 | A() { } |
| 21 | ~A() { AccessC(); printf("PASSED\n"); } |
| 22 | // CHECK-NOT: AddressSanitizer |
| 23 | // CHECK: PASSED |
| 24 | }; |
| 25 | |
| 26 | A a; |
| 27 | |
| 28 | class B { |
| 29 | public: |
| 30 | B() { exit(1); } |
| 31 | ~B() { } |
| 32 | }; |
| 33 | |
| 34 | B b; |