[clang] [Clang] [CodeGen] UBSan Trap Reasons (PR #145967)
Anthony Tran via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 30 23:08:07 PDT 2025
================
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple arm64-apple-macosx14.0.0 -O0 -debug-info-kind=standalone -dwarf-version=5 \
+// RUN: -fsanitize=signed-integer-overflow -fsanitize-trap=signed-integer-overflow -emit-llvm %s -o - | FileCheck %s
+
+int add_overflow(int a, int b) {
+ return a + b;
+}
+
+// CHECK: call void @llvm.ubsantrap(i8 0) {{.*}}!dbg [[LOC:![0-9]+]]
+// CHECK: [[LOC]] = !DILocation(line: 0, scope: [[MSG:![0-9]+]], {{.+}})
+// CHECK: distinct !DISubprogram(name: "__clang_trap_msg$Undefined Behavior Sanitizer
----------------
anthonyhatran wrote:
I explicitly left it out because I wanted to hear feedback on the strings after running tests without `-fsanitize-trap=undefined` and viewing what runtime UBSan (non-trapping) printed. I will add the TrapMessage checks in the next PR.
https://github.com/llvm/llvm-project/pull/145967
More information about the cfe-commits
mailing list