Skip to content

Commit 8d9e3cf

Browse files
committed
Fix and add tests
1 parent adf6d32 commit 8d9e3cf

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %clang_min_runtime -fsanitize=alignment %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
2+
3+
void f(int& n) {}
4+
5+
int* t;
6+
7+
int main() {
8+
int r;
9+
t = (int*)(((char*)&r) + 1);
10+
// CHECK: ubsan: type-mismatch by 0x{{[[:xdigit:]]+}} address 0x{{[[:xdigit:]]+$}}
11+
// CHECK-NOT: type-mismatch
12+
13+
f(*t);
14+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %clang_min_runtime -fsanitize=null %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK
2+
3+
void f(int& n) {}
4+
5+
int* t;
6+
7+
int main() {
8+
// CHECK: ubsan: type-mismatch by 0x{{[[:xdigit:]]+}} address 0x{{[[:xdigit:]]+$}}
9+
// CHECK-NOT: type-mismatch
10+
f(*t);
11+
}

compiler-rt/test/ubsan_minimal/TestCases/override-callback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
static int Result;
1010

11-
void __ubsan_report_error(const char *kind, uintptr_t caller) {
11+
void __ubsan_minimal_report_error(const char *kind, uintptr_t caller) {
1212
fprintf(stderr, "CUSTOM_CALLBACK: %s\n", kind);
1313
}
1414

1515
#if OVERRIDE
16-
void __ubsan_report_error_fatal(const char *kind, uintptr_t caller) {
16+
void __ubsan_minimal_report_error_fatal(const char *kind, uintptr_t caller) {
1717
fprintf(stderr, "FATAL_CALLBACK: %s\n", kind);
1818
}
1919
#endif

0 commit comments

Comments
 (0)