Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / Linux / init_fini_sections.cpp
blob3037b232926ee05e7c4e927da96a4b7b2a563136
1 // RUN: %clangxx_asan %s -o %t && %run %t | FileCheck %s
3 #include <stdio.h>
5 int c = 0;
7 static void foo() {
8 ++c;
11 static void fini() {
12 printf("fini\n");
15 int main() {
16 printf("c=%d\n", c);
17 return 0;
20 __attribute__((section(".preinit_array")))
21 void (*call_foo)(void) = &foo;
23 __attribute__((section(".init_array")))
24 void (*call_foo_2)(void) = &foo;
26 __attribute__((section(".fini_array")))
27 void (*call_foo_3)(void) = &fini;
29 // CHECK: c=2
30 // CHECK: fini