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
92 lines
2.1 KiB
C
92 lines
2.1 KiB
C
// RUN: %clang_dfsan %s -O1 -o %t && %run %t
|
|
// RUN: %clang_dfsan %s -O0 -DO0 -o %t && %run %t
|
|
|
|
#include <assert.h>
|
|
#include <sanitizer/dfsan_interface.h>
|
|
|
|
// SystemZ identifies labels for struct elements precisely across all
|
|
// optimization labels.
|
|
|
|
typedef struct Pair {
|
|
int i;
|
|
char *ptr;
|
|
} Pair;
|
|
|
|
__attribute__((noinline))
|
|
Pair make_pair(int i, char *ptr) {
|
|
Pair pair;
|
|
pair.i = i;
|
|
pair.ptr = ptr;
|
|
return pair;
|
|
}
|
|
|
|
__attribute__((noinline))
|
|
Pair copy_pair1(const Pair *pair0) {
|
|
Pair pair;
|
|
pair.i = pair0->i;
|
|
pair.ptr = pair0->ptr;
|
|
return pair;
|
|
}
|
|
|
|
__attribute__((noinline))
|
|
Pair copy_pair2(const Pair pair0) {
|
|
Pair pair;
|
|
pair.i = pair0.i;
|
|
pair.ptr = pair0.ptr;
|
|
return pair;
|
|
}
|
|
|
|
int main(void) {
|
|
int i = 1;
|
|
char *ptr = NULL;
|
|
dfsan_label i_label = 1;
|
|
dfsan_label ptr_label = 2;
|
|
dfsan_set_label(i_label, &i, sizeof(i));
|
|
dfsan_set_label(ptr_label, &ptr, sizeof(ptr));
|
|
|
|
Pair pair1 = make_pair(i, ptr);
|
|
int i1 = pair1.i;
|
|
char *ptr1 = pair1.ptr;
|
|
|
|
dfsan_label i1_label = dfsan_read_label(&i1, sizeof(i1));
|
|
dfsan_label ptr1_label = dfsan_read_label(&ptr1, sizeof(ptr1));
|
|
#if defined(O0) && !defined(__s390x__)
|
|
assert(i1_label == (i_label | ptr_label));
|
|
assert(ptr1_label == (i_label | ptr_label));
|
|
#else
|
|
assert(i1_label == i_label);
|
|
assert(ptr1_label == ptr_label);
|
|
#endif
|
|
|
|
Pair pair2 = copy_pair1(&pair1);
|
|
int i2 = pair2.i;
|
|
char *ptr2 = pair2.ptr;
|
|
|
|
dfsan_label i2_label = dfsan_read_label(&i2, sizeof(i2));
|
|
dfsan_label ptr2_label = dfsan_read_label(&ptr2, sizeof(ptr2));
|
|
#if defined(O0) && !defined(__s390x__)
|
|
assert(i2_label == (i_label | ptr_label));
|
|
assert(ptr2_label == (i_label | ptr_label));
|
|
#else
|
|
assert(i2_label == i_label);
|
|
assert(ptr2_label == ptr_label);
|
|
#endif
|
|
|
|
Pair pair3 = copy_pair2(pair1);
|
|
int i3 = pair3.i;
|
|
char *ptr3 = pair3.ptr;
|
|
|
|
dfsan_label i3_label = dfsan_read_label(&i3, sizeof(i3));
|
|
dfsan_label ptr3_label = dfsan_read_label(&ptr3, sizeof(ptr3));
|
|
#if defined(O0) && !defined(__s390x__)
|
|
assert(i3_label == (i_label | ptr_label));
|
|
assert(ptr3_label == (i_label | ptr_label));
|
|
#else
|
|
assert(i3_label == i_label);
|
|
assert(ptr3_label == ptr_label);
|
|
#endif
|
|
|
|
|
|
return 0;
|
|
}
|