mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 05:26:47 +00:00

There are several files in the compiler-rt subproject that have command not found errors. This patch uses the `env` command to properly set the environment variables correctly when using the lit internal shell. fixes: #102395 [This change is relevant [RFC] Enabling the lit internal shell by Default](https://discourse.llvm.org/t/rfc-enabling-the-lit-internal-shell-by-default/80179)
25 lines
533 B
C
25 lines
533 B
C
/// The static TLS block is reused among by threads. The shadow is cleared.
|
|
// RUN: %clang_nsan %s -o %t
|
|
// RUN: env NSAN_OPTIONS=halt_on_error=1,log2_max_relative_error=19 %run %t
|
|
|
|
#include <pthread.h>
|
|
#include <stdio.h>
|
|
|
|
__thread float x;
|
|
|
|
static void *ThreadFn(void *a) {
|
|
long i = (long)a;
|
|
for (long j = i * 1000; j < (i + 1) * 1000; j++)
|
|
x += j;
|
|
printf("%f\n", x);
|
|
return 0;
|
|
}
|
|
|
|
int main() {
|
|
pthread_t t;
|
|
for (long i = 0; i < 5; ++i) {
|
|
pthread_create(&t, 0, ThreadFn, (void *)i);
|
|
pthread_join(t, 0);
|
|
}
|
|
}
|