1 // RUN: %clangxx -w -fsanitize=bool -fno-sanitize-memory-param-retval %s -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s
4 // __ubsan_on_report is not defined as weak. Redefining it here isn't supported
7 // UNSUPPORTED: target={{.*windows.*}}
9 // XFAIL: target={{.*openbsd.*}}
13 // Override __ubsan_on_report() from the runtime, just for testing purposes.
14 // Required for dyld macOS 12.0+
19 __ubsan_on_report(void) {
20 void __ubsan_get_current_report_data(
21 const char **OutIssueKind
, const char **OutMessage
,
22 const char **OutFilename
, unsigned *OutLine
, unsigned *OutCol
,
23 char **OutMemoryAddr
);
24 const char *IssueKind
, *Message
, *Filename
;
28 __ubsan_get_current_report_data(&IssueKind
, &Message
, &Filename
, &Line
, &Col
,
31 printf("Issue: %s\n", IssueKind
);
32 printf("Location: %s:%u:%u\n", Filename
, Line
, Col
);
33 printf("Message: %s\n", Message
);
42 // CHECK: Issue: invalid-bool-load
43 // CHECK-NEXT: Location: {{.*}}monitor.cpp:[[@LINE-2]]:12
44 // CHECK-NEXT: Message: Load of value 3, which is not a valid value for type 'bool'