view compiler-rt/test/hwasan/TestCases/pthread_create.c @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1f2b6ac9f198
children
line wrap: on
line source

// Tests that our thread initialization hooks work properly with random_tags=1.
// RUN: %clang_hwasan %s -o %t
// RUN: %env_hwasan_opts=random_tags=1 %run %t

#include <pthread.h>

#include <sanitizer/hwasan_interface.h>

volatile int state;

void *Increment(void *arg) {
  ++state;
  return NULL;
}

int main() {
  __hwasan_enable_allocator_tagging();
  pthread_t t1;
  pthread_create(&t1, NULL, Increment, NULL);
  pthread_join(t1, NULL);
}