CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
// RUN: %clangxx_asan -O0 %s -pthread -o %t -mllvm -asan-detect-invalid-pointer-pair
|
|
|
|
// RUN: %env_asan_opts=detect_invalid_pointer_pairs=2 %run %t a 2>&1 | FileCheck %s -check-prefix=OK -allow-empty
|
|
// RUN: %env_asan_opts=detect_invalid_pointer_pairs=2 not %run %t b 2>&1 | FileCheck %s -check-prefix=B
|
|
|
|
// pthread barriers are not available on OS X
|
|
// UNSUPPORTED: darwin
|
|
|
|
#include <assert.h>
|
|
#include <pthread.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
char *pointers[2];
|
|
pthread_barrier_t bar;
|
|
|
|
void *thread_main(void *n) {
|
|
char local;
|
|
|
|
unsigned long id = (unsigned long)n;
|
|
pointers[id] = &local;
|
|
pthread_barrier_wait(&bar);
|
|
pthread_barrier_wait(&bar);
|
|
|
|
return NULL;
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
assert(argc >= 2);
|
|
|
|
char t = argv[1][0];
|
|
|
|
pthread_t threads[2];
|
|
pthread_barrier_init(&bar, NULL, 3);
|
|
pthread_create(&threads[0], 0, thread_main, (void *)0);
|
|
pthread_create(&threads[1], 0, thread_main, (void *)1);
|
|
pthread_barrier_wait(&bar);
|
|
|
|
if (t == 'a') {
|
|
// OK-NOT: not handled yet
|
|
unsigned r = pointers[0] - pointers[1];
|
|
} else {
|
|
char local;
|
|
char *parent_pointer = &local;
|
|
|
|
// B: ERROR: AddressSanitizer: invalid-pointer-pair
|
|
// B: #{{[0-9]+ .*}} in main {{.*}}invalid-pointer-pairs-threads.cpp:[[@LINE+1]]
|
|
unsigned r = parent_pointer - pointers[0];
|
|
}
|
|
|
|
pthread_barrier_wait(&bar);
|
|
pthread_join(threads[0], 0);
|
|
pthread_join(threads[1], 0);
|
|
pthread_barrier_destroy(&bar);
|
|
|
|
return 0;
|
|
}
|