1 // RUN: %clang_hwasan %s -o %t && %env_hwasan_opts=random_tags=1 %run %t
2 // REQUIRES: stable-runtime
3 
4 #include <pthread.h>
5 #include <sanitizer/hwasan_interface.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 
ThreadFn(void *)10 void *ThreadFn(void *) {
11   strerror_l(-1, 0);
12   __hwasan_enable_allocator_tagging();
13   // This will trigger memory deallocation in __strerror_thread_freeres,
14   // at a point when HwasanThread is already gone.
15 }
16 
main()17 int main() {
18   pthread_t t;
19   pthread_create(&t, NULL, ThreadFn, NULL);
20   pthread_join(t, NULL);
21   return 0;
22 }
23