[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / msan / chained_origin_with_signals.cc
blob5fd497eaedbefe1de4d75ef0b669c4f5e33cfa77
1 // Check that stores in signal handlers are not recorded in origin history.
2 // This is, in fact, undesired behavior caused by our chained origins
3 // implementation being not async-signal-safe.
5 // RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t && \
6 // RUN: not %run %t >%t.out 2>&1
7 // RUN: FileCheck %s < %t.out
9 #include <signal.h>
10 #include <stdio.h>
11 #include <sys/types.h>
12 #include <unistd.h>
14 volatile int x, y;
16 void SignalHandler(int signo) {
17 y = x;
20 int main(int argc, char *argv[]) {
21 int volatile z;
22 x = z;
24 signal(SIGUSR1, SignalHandler);
25 kill(getpid(), SIGUSR1);
26 signal(SIGUSR1, SIG_DFL);
28 return y;
31 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
32 // CHECK-NOT: in SignalHandler