llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-backend-amdgpu Author: Jerry Dang (kuroyukiasuna) <details> <summary>Changes</summary> Adds a new UBSan check, `unaligned-pointer-subtraction`, that detects subtraction of two pointers whose byte distance is not an exact multiple of the pointee size. AI Usage Disclosure LLM was used to help the investigation and test writing/fixing. Fixes #<!-- -->206775 --- Patch is 51.67 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/210635.diff 22 Files Affected: - (modified) clang/docs/ReleaseNotes.md (+4) - (modified) clang/docs/UndefinedBehaviorSanitizer.md (+2) - (modified) clang/include/clang/Basic/Sanitizers.def (+3-1) - (modified) clang/lib/CodeGen/CGExprScalar.cpp (+20) - (modified) clang/lib/CodeGen/SanitizerHandler.h (+4) - (modified) clang/test/CodeGen/allow-ubsan-check.c (+4-4) - (added) clang/test/CodeGen/ubsan-unaligned-pointer-subtraction.c (+84) - (modified) clang/test/Driver/amdgpu-validate-sanitize.cl (+1-1) - (modified) clang/test/Driver/fsanitize-annotate-debug-info.c (+3-3) - (modified) clang/test/Driver/fsanitize-merge.c (+3-3) - (modified) clang/test/Driver/fsanitize-minimal-runtime.c (+4-4) - (modified) clang/test/Driver/fsanitize-recover.c (+1-1) - (modified) clang/test/Driver/fsanitize-skip-hot-cutoff.c (+4-4) - (modified) clang/test/Driver/fsanitize-trap.c (+3-3) - (modified) clang/test/Driver/fsanitize-undefined.c (+5-5) - (modified) clang/test/Driver/fsanitize.c (+2-2) - (modified) compiler-rt/lib/ubsan/ubsan_checks.inc (+2) - (modified) compiler-rt/lib/ubsan/ubsan_handlers.cpp (+33) - (modified) compiler-rt/lib/ubsan/ubsan_handlers.h (+9) - (modified) compiler-rt/lib/ubsan/ubsan_interface.inc (+2) - (modified) compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp (+1) - (added) compiler-rt/test/ubsan/TestCases/Pointer/unaligned-pointer-subtraction.c (+66) ``````````diff diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md index a39bc2dfc5b6d..fb7d66e0e7183 100644 --- a/clang/docs/ReleaseNotes.md +++ b/clang/docs/ReleaseNotes.md @@ -423,6 +423,10 @@ latest release, please see the [Clang Web Site](https://clang.llvm.org) or the ### Sanitizers +- Introduced `-fsanitize=unaligned-pointer-subtraction`, a new UndefinedBehaviorSanitizer check that + flag subtraction of two pointers whose byte distance is not a multiple of the element size. + It is part of the `undefined` group. + ### Python Binding Changes ### OpenMP Support diff --git a/clang/docs/UndefinedBehaviorSanitizer.md b/clang/docs/UndefinedBehaviorSanitizer.md index 25587c6e8cb3c..0a23b2a9d6aa5 100644 --- a/clang/docs/UndefinedBehaviorSanitizer.md +++ b/clang/docs/UndefinedBehaviorSanitizer.md @@ -173,6 +173,8 @@ Available checks are: - `-fsanitize=pointer-overflow`: Performing pointer arithmetic which overflows, or where either the old or new pointer value is a null pointer (excluding the case where both are null pointers). +- `-fsanitize=unaligned-pointer-subtraction`: Subtraction of two pointers whose + byte distance is not a multiple of the element size. - `-fsanitize=return`: In C++, reaching the end of a value-returning function without returning a value. - `-fsanitize=returns-nonnull-attribute`: Returning null pointer diff --git a/clang/include/clang/Basic/Sanitizers.def b/clang/include/clang/Basic/Sanitizers.def index da85431625026..c58c28f9dc7eb 100644 --- a/clang/include/clang/Basic/Sanitizers.def +++ b/clang/include/clang/Basic/Sanitizers.def @@ -113,6 +113,7 @@ SANITIZER("shift-base", ShiftBase) SANITIZER("shift-exponent", ShiftExponent) SANITIZER_GROUP("shift", Shift, ShiftBase | ShiftExponent) SANITIZER("signed-integer-overflow", SignedIntegerOverflow) +SANITIZER("unaligned-pointer-subtraction", UnalignedPointerSubtraction) SANITIZER("unreachable", Unreachable) SANITIZER("vla-bound", VLABound) SANITIZER("vptr", Vptr) @@ -152,7 +153,8 @@ SANITIZER_GROUP("undefined", Undefined, FloatCastOverflow | IntegerDivideByZero | NonnullAttribute | Null | ObjectSize | PointerOverflow | Return | ReturnsNonnullAttribute | Shift | - SignedIntegerOverflow | Unreachable | VLABound | Function) + SignedIntegerOverflow | Unreachable | VLABound | Function | + UnalignedPointerSubtraction) // -fsanitize=undefined-trap is an alias for -fsanitize=undefined. SANITIZER_GROUP("undefined-trap", UndefinedTrap, Undefined) diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 81016d3d5d308..a7b8c7f406991 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -20,6 +20,7 @@ #include "CodeGenFunction.h" #include "CodeGenModule.h" #include "ConstantEmitter.h" +#include "SanitizerHandler.h" #include "TargetInfo.h" #include "TrapReasonBuilder.h" #include "clang/AST/ASTContext.h" @@ -5021,6 +5022,25 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &op) { divisor = CGF.CGM.getSize(elementSize); } + // If the unaligned-pointer-subtraction sanitizer is on, verify at runtime + // that the byte distance is an exact multiple of the element size. + if (CGF.SanOpts.has(SanitizerKind::UnalignedPointerSubtraction)) { + auto checkOrdinal = SanitizerKind::SO_UnalignedPointerSubtraction; + auto CheckHandler = SanitizerHandler::UnalignedPointerSubtraction; + SanitizerDebugLocation SanScope(&CGF, {checkOrdinal}, CheckHandler); + + llvm::Value *Zero = llvm::ConstantInt::get(CGF.PtrDiffTy, 0); + llvm::Value *Rem = Builder.CreateSRem(diffInChars, divisor, "sub.ptr.rem"); + llvm::Value *IsExact = Builder.CreateICmpEQ(Rem, Zero, "sub.ptr.exact"); + + llvm::Constant *StaticArgs[] = { + CGF.EmitCheckSourceLocation(op.E->getExprLoc()), + CGF.EmitCheckTypeDescriptor(op.E->getType())}; + llvm::Value *DynamicArgs[] = {diffInChars, divisor}; + CGF.EmitCheck({{IsExact, checkOrdinal}}, CheckHandler, StaticArgs, + DynamicArgs); + } + // Otherwise, do a full sdiv. This uses the "exact" form of sdiv, since // pointer difference in C is only defined in the case where both operands // are pointing to elements of an array. diff --git a/clang/lib/CodeGen/SanitizerHandler.h b/clang/lib/CodeGen/SanitizerHandler.h index 871e17c22d3fa..b39f4f22de48c 100644 --- a/clang/lib/CodeGen/SanitizerHandler.h +++ b/clang/lib/CodeGen/SanitizerHandler.h @@ -70,6 +70,10 @@ SANITIZER_CHECK( \ VLABoundNotPositive, vla_bound_not_positive, 0, \ "Variable length array bound evaluates to non-positive value") \ + SANITIZER_CHECK( \ + UnalignedPointerSubtraction, unaligned_pointer_subtraction, 0, \ + "Pointer subtraction where the byte distance is not a multiple of the " \ + "element size") \ SANITIZER_CHECK(BoundsSafety, bounds_safety, 0, \ "") // BoundsSafety Msg is empty because it is not considered // part of UBSan; therefore, no trap reason is emitted for diff --git a/clang/test/CodeGen/allow-ubsan-check.c b/clang/test/CodeGen/allow-ubsan-check.c index 0fc95c41b3e3d..beb6fbdcb3c41 100644 --- a/clang/test/CodeGen/allow-ubsan-check.c +++ b/clang/test/CodeGen/allow-ubsan-check.c @@ -200,7 +200,7 @@ void use(double*); // CHECK-NEXT: call void @use(ptr noundef nonnull [[VLA]]) #[[ATTR7:[0-9]+]] // CHECK-NEXT: [[IDXPROM:%.*]] = sext i32 [[I]] to i64 // CHECK-NEXT: [[TMP1:%.*]] = icmp ule i64 [[TMP0]], [[IDXPROM]] -// CHECK-NEXT: [[TMP2:%.*]] = call i1 @llvm.allow.ubsan.check(i8 71), !nosanitize [[META6]] +// CHECK-NEXT: [[TMP2:%.*]] = call i1 @llvm.allow.ubsan.check(i8 72), !nosanitize [[META6]] // CHECK-NEXT: [[TMP3:%.*]] = and i1 [[TMP1]], [[TMP2]], !nosanitize [[META6]] // CHECK-NEXT: br i1 [[TMP3]], label %[[TRAP:.*]], label %[[BB4:.*]] // CHECK: [[BB4]]: @@ -219,7 +219,7 @@ void use(double*); // TR-NEXT: call void @use(ptr noundef nonnull [[VLA]]) #[[ATTR8:[0-9]+]] // TR-NEXT: [[IDXPROM:%.*]] = sext i32 [[I]] to i64 // TR-NEXT: [[TMP1:%.*]] = icmp ule i64 [[TMP0]], [[IDXPROM]] -// TR-NEXT: [[TMP2:%.*]] = call i1 @llvm.allow.ubsan.check(i8 71), !nosanitize [[META6]] +// TR-NEXT: [[TMP2:%.*]] = call i1 @llvm.allow.ubsan.check(i8 72), !nosanitize [[META6]] // TR-NEXT: [[TMP3:%.*]] = and i1 [[TMP1]], [[TMP2]], !nosanitize [[META6]] // TR-NEXT: br i1 [[TMP3]], label %[[TRAP:.*]], label %[[BB4:.*]] // TR: [[BB4]]: @@ -227,7 +227,7 @@ void use(double*); // TR-NEXT: [[TMP5:%.*]] = load double, ptr [[ARRAYIDX]], align 8, !tbaa [[DOUBLE_TBAA10:![0-9]+]] // TR-NEXT: ret double [[TMP5]] // TR: [[TRAP]]: -// TR-NEXT: call void @llvm.ubsantrap(i8 71) #[[ATTR7]], !nosanitize [[META6]] +// TR-NEXT: call void @llvm.ubsantrap(i8 72) #[[ATTR7]], !nosanitize [[META6]] // TR-NEXT: unreachable, !nosanitize [[META6]] // // REC-LABEL: define dso_local double @lbounds( @@ -238,7 +238,7 @@ void use(double*); // REC-NEXT: call void @use(ptr noundef nonnull [[VLA]]) #[[ATTR5:[0-9]+]] // REC-NEXT: [[IDXPROM:%.*]] = sext i32 [[I]] to i64 // REC-NEXT: [[TMP1:%.*]] = icmp ule i64 [[TMP0]], [[IDXPROM]] -// REC-NEXT: [[TMP2:%.*]] = call i1 @llvm.allow.ubsan.check(i8 71), !nosanitize [[META6]] +// REC-NEXT: [[TMP2:%.*]] = call i1 @llvm.allow.ubsan.check(i8 72), !nosanitize [[META6]] // REC-NEXT: [[TMP3:%.*]] = and i1 [[TMP1]], [[TMP2]], !nosanitize [[META6]] // REC-NEXT: br i1 [[TMP3]], label %[[TRAP:.*]], label %[[BB4:.*]] // REC: [[BB4]]: diff --git a/clang/test/CodeGen/ubsan-unaligned-pointer-subtraction.c b/clang/test/CodeGen/ubsan-unaligned-pointer-subtraction.c new file mode 100644 index 0000000000000..08217f2f6eba3 --- /dev/null +++ b/clang/test/CodeGen/ubsan-unaligned-pointer-subtraction.c @@ -0,0 +1,84 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -x c -w -emit-llvm -o - %s \ +// RUN: -fsanitize=unaligned-pointer-subtraction | \ +// RUN: FileCheck %s --check-prefixes=CHECK,CONLY +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -x c++ -w -emit-llvm -o - %s \ +// RUN: -fsanitize=unaligned-pointer-subtraction | \ +// RUN: FileCheck %s +// +// Verify that -fsanitize=unaligned-pointer-subtraction instruments the +// subtraction of two pointers: it checks at runtime that the byte distance is +// an exact multiple of the element size, and skips the check when the element +// size is one (where the remainder is trivially zero). + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { int x, y; } A; // sizeof(A) == 8 + +// Constant element size: the byte distance is divided by 8, so a check is +// emitted before the exact division. +// CHECK-LABEL: define{{.*}} i64 @f_const( +long f_const(int *p) { + // CHECK: %sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast + // CHECK-NEXT: %sub.ptr.rem = srem i64 %sub.ptr.sub, 8, !nosanitize + // CHECK-NEXT: %sub.ptr.exact = icmp eq i64 %sub.ptr.rem, 0, !nosanitize + // CHECK-NEXT: br i1 %sub.ptr.exact, label %cont, label %handler.unaligned_pointer_subtraction{{.*}}, !nosanitize + // CHECK: call void @__ubsan_handle_unaligned_pointer_subtraction{{.*}}(ptr @{{[0-9]+}}, i64 %sub.ptr.sub, i64 8) + // CHECK: %sub.ptr.div = sdiv exact i64 %sub.ptr.sub, 8 + return (A *)(p + 1) - (A *)p; +} + +// Element size one (char): no divide is emitted, so no check either. +// CHECK-LABEL: define{{.*}} i64 @f_char( +long f_char(char *a, char *b) { + // CHECK-NOT: srem + // CHECK-NOT: __ubsan_handle_unaligned_pointer_subtraction + // CHECK: ret i64 + return a - b; +} + +#ifdef __cplusplus +} // extern "C" +#endif + +// The remaining cases use pointer arithmetic that is only valid in C: VLA +// element types and the GNU void*/function-pointer extensions. They are +// compiled and checked only in the C RUN line (CONLY). +#ifndef __cplusplus + +// VLA element type: the divisor is a runtime value (sizeof(int) * n), so the +// remainder check runs against a non-constant divisor. +// CONLY-LABEL: define{{.*}} i64 @f_vla( +long f_vla(int n, int (*p)[n]) { + int (*q)[n] = (int (*)[n])((char *)p + 4); + // CONLY: %sub.ptr.sub = sub i64 %sub.ptr.lhs.cast, %sub.ptr.rhs.cast + // CONLY-NEXT: %[[ELT:[0-9]+]] = mul nuw i64 4, %{{[0-9]+}} + // CONLY-NEXT: %sub.ptr.rem = srem i64 %sub.ptr.sub, %[[ELT]], !nosanitize + // CONLY-NEXT: %sub.ptr.exact = icmp eq i64 %sub.ptr.rem, 0, !nosanitize + // CONLY: call void @__ubsan_handle_unaligned_pointer_subtraction{{.*}}(ptr @{{[0-9]+}}, i64 %sub.ptr.sub, i64 %[[ELT]]) + // CONLY: %sub.ptr.div = sdiv exact i64 %sub.ptr.sub, %[[ELT]] + return q - p; +} + +// void* arithmetic (GNU extension) has element size one: no check. +// CONLY-LABEL: define{{.*}} i64 @f_void( +long f_void(void *a, void *b) { + // CONLY-NOT: srem + // CONLY-NOT: __ubsan_handle_unaligned_pointer_subtraction + // CONLY: ret i64 + return a - b; +} + +typedef void (*fp)(void); + +// Function-pointer arithmetic (GNU extension) has element size one: no check. +// CONLY-LABEL: define{{.*}} i64 @f_func( +long f_func(fp a, fp b) { + // CONLY-NOT: srem + // CONLY-NOT: __ubsan_handle_unaligned_pointer_subtraction + // CONLY: ret i64 + return a - b; +} + +#endif // !__cplusplus diff --git a/clang/test/Driver/amdgpu-validate-sanitize.cl b/clang/test/Driver/amdgpu-validate-sanitize.cl index 907ad201b15b3..ddd80374cdfc4 100644 --- a/clang/test/Driver/amdgpu-validate-sanitize.cl +++ b/clang/test/Driver/amdgpu-validate-sanitize.cl @@ -33,7 +33,7 @@ // CHECK-SAME: "-fsanitize=address" -// GENERIC: "-fsanitize=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,nullability-arg,nullability-assign,nullability-return,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,unsigned-integer-overflow,unsigned-shift-base,implicit-unsigned-integer-truncation,implicit-signed-integer-truncation,implicit-integer-sign-change,implicit-bitfield-conversion,local-bounds,alloc-token" "-fsanitize-recover=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,nullability-arg,nullability-assign,nullability-return,pointer-overflow,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound,unsigned-integer-overflow,unsigned-shift-base,implicit-unsigned-integer-truncation,implicit-signed-integer-truncation,implicit-integer-sign-change,implicit-bitfield-conversion" "-fsanitize-trap=local-bounds" "-fsanitize-merge=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound" +// GENERIC: "-fsanitize=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,nullability-arg,nullability-assign,nullability-return,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unaligned-pointer-subtraction,unreachable,vla-bound,unsigned-integer-overflow,unsigned-shift-base,implicit-unsigned-integer-truncation,implicit-signed-integer-truncation,implicit-integer-sign-change,implicit-bitfield-conversion,local-bounds,alloc-token" "-fsanitize-recover=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,nullability-arg,nullability-assign,nullability-return,pointer-overflow,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unaligned-pointer-subtraction,vla-bound,unsigned-integer-overflow,unsigned-shift-base,implicit-unsigned-integer-truncation,implicit-signed-integer-truncation,implicit-integer-sign-change,implicit-bitfield-conversion" "-fsanitize-trap=local-bounds" "-fsanitize-merge=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unaligned-pointer-subtraction,unreachable,vla-bound" // FIXME: Should not be forwarding argument diff --git a/clang/test/Driver/fsanitize-annotate-debug-info.c b/clang/test/Driver/fsanitize-annotate-debug-info.c index 27ffe950579d3..53ce753e53837 100644 --- a/clang/test/Driver/fsanitize-annotate-debug-info.c +++ b/clang/test/Driver/fsanitize-annotate-debug-info.c @@ -8,7 +8,7 @@ // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-annotate-debug-info=signed-integer-overflow -fsanitize-annotate-debug-info %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fsanitize-annotate-debug-info=bool -fsanitize-annotate-debug-info=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fsanitize-annotate-debug-info=undefined -fsanitize-annotate-debug-info=bool %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO -// CHECK-UNDEFINED-PSEUDO: "-fsanitize-annotate-debug-info=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound" +// CHECK-UNDEFINED-PSEUDO: "-fsanitize-annotate-debug-info=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unaligned-pointer-subtraction,unreachable,vla-bound" // The trailing arguments (-fsanitize-annotate-debug-info -fno-sanitize-annotate-debug-info=signed-integer-overflow) take precedence // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fsanitize-annotate-debug-info -fno-sanitize-annotate-debug-info=signed-integer-overflow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO2 @@ -17,7 +17,7 @@ // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-annotate-debug-info -fsanitize-annotate-debug-info=undefined -fno-sanitize-annotate-debug-info=signed-integer-overflow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO2 // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-annotate-debug-info=signed-integer-overflow -fsanitize-annotate-debug-info -fno-sanitize-annotate-debug-info=signed-integer-overflow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO2 // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-annotate-debug-info=signed-integer-overflow -fsanitize-annotate-debug-info=undefined -fno-sanitize-annotate-debug-info=signed-integer-overflow %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO2 -// CHECK-UNDEFINED-PSEUDO2: "-fsanitize-annotate-debug-info=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,unreachable,vla-bound" +// CHECK-UNDEFINED-PSEUDO2: "-fsanitize-annotate-debug-info=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,unaligned-pointer-subtraction,unreachable,vla-bound" // The trailing -fno-sanitize-annotate-debug-info takes precedence // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-annotate-debug-info %s -### 2>&1 | not FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO3 @@ -37,7 +37,7 @@ // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-annotate-debug-info -fsanitize-annotate-debug-info=undefined -fno-sanitize-annotate-debug-info=alignment,null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO4 // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-annotate-debug-info=signed-integer-overflow -fsanitize-annotate-debug-info -fno-sanitize-annotate-debug-info=alignment,null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO4 // RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -fno-sanitize-annotate-debug-info=signed-integer-overflow -fsanitize-annotate-debug-info=undefined -fno-sanitize-annotate-debug-info=alignment,null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-PSEUDO4 -// CHECK-UNDEFINED-PSEUDO4: "-fsanitize-annotate-debug-info=array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound" +// CHECK-UNDEFINED-PSEUDO4: "-fsanitize-annotate-debug-info=array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unaligned-pointer-subtraction,unreachable,vla-bound" // The trailing arguments (-fno-sanitize-annotate-debug-info -fsanitize-annotate-debug-info=alignment,null) t... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/210635 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
