[clang] [compiler-rt] [ubsan] Display correct runtime messages for negative _BitInt (PR #93612)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 14:08:33 PDT 2024


fmayer wrote:

Breakage looks related: https://lab.llvm.org/buildbot/#/builders/72/builds/265

```
FAIL: UBSan-MemorySanitizer-powerpc64le :: TestCases/Integer/bit-int.c (4716 of 4745)
******************** TEST 'UBSan-MemorySanitizer-powerpc64le :: TestCases/Integer/bit-int.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_gcc/./bin/clang  -fsanitize=memory  -m64 -fno-function-sections  -Wno-constant-conversion -Wno-array-bounds -Wno-division-by-zero -Wno-shift-negative-value -Wno-shift-count-negative -Wno-int-to-pointer-cast -O0 -fsanitize=alignment,array-bounds,bool,float-cast-overflow,implicit-integer-sign-change,implicit-signed-integer-truncation,implicit-unsigned-integer-truncation,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,unreachable,unsigned-integer-overflow,unsigned-shift-base,vla-bound /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_g
 cc/runtimes/runtimes-bins/compiler-rt/test/ubsan/MemorySanitizer-powerpc64le/TestCases/Integer/Output/bit-int.c.tmp1 &&  /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_gcc/runtimes/runtimes-bins/compiler-rt/test/ubsan/MemorySanitizer-powerpc64le/TestCases/Integer/Output/bit-int.c.tmp1 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c --check-prefix=RUNTIME
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_gcc/./bin/clang -fsanitize=memory -m64 -fno-function-sections -Wno-constant-conversion -Wno-array-bounds -Wno-division-by-zero -Wno-shift-negative-value -Wno-shift-count-negative -Wno-int-to-pointer-cast -O0 -fsanitize=alignment,array-bounds,bool,float-cast-overflow,implicit-integer-sign-change,implicit-signed-integer-truncation,implicit-unsigned-integer-truncation,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,unreachable,unsigned-integer-overflow,unsigned-shift-base,vla-bound /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_gcc/runtimes/runti
 mes-bins/compiler-rt/test/ubsan/MemorySanitizer-powerpc64le/TestCases/Integer/Output/bit-int.c.tmp1
+ /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_gcc/runtimes/runtimes-bins/compiler-rt/test/ubsan/MemorySanitizer-powerpc64le/TestCases/Integer/Output/bit-int.c.tmp1
+ FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c --check-prefix=RUNTIME
/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c:93:14: error: RUNTIME: expected string not found in input
 // RUNTIME: {{.*}}bit-int.c:[[@LINE-1]]:24: runtime error: left shift of negative value -1
             ^
<stdin>:25:206: note: scanning from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c:86:21: runtime error: shift exponent -1 is negative
                                                                                                                                                                                                             ^
<stdin>:25:206: note: with "@LINE-1" equal to "92"
/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c:86:21: runtime error: shift exponent -1 is negative
                                                                                                                                                                                                             ^
<stdin>:33:252: note: possible intended match here
SUMMARY: MemorySanitizer: use-of-uninitialized-value (/home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/build_gcc/runtimes/runtimes-bins/compiler-rt/test/ubsan/MemorySanitizer-powerpc64le/TestCases/Integer/Output/bit-int.c.tmp1+0xe6d64) in shift_exponent
                                                                                                                                                                                                                                                           ^

Input file: <stdin>
Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
           20: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c:65:18 
           21: /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c:72:19: runtime error: implicit conversion from type 'unsigned _BitInt(37)' of value 137438953471 (64-bit, unsigned) to type '_BitInt(37)' changed the value to -1 (64-bit, signed)
           22: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c:72:19 
           23: /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c:79:10: runtime error: implicit conversion from type '_BitInt(73)' of value 0x00000000000000008000000000000000 (128-bit, signed) to type '_BitInt(13)' changed the value to 0 (16-bit, signed)
           24: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c:79:10 
           25: /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/compiler-rt/test/ubsan/TestCases/Integer/bit-int.c:86:21: runtime error: shift exponent -1 is negative
Step 9 (test compiler-rt gcc) failure: test compiler-rt gcc (failure)

```

https://github.com/llvm/llvm-project/pull/93612


More information about the llvm-commits mailing list