[PATCH] D63984: [ubsan][test] Fix several UBSan-* :: TestCases/ImplicitConversion tests on Solaris
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 02:25:27 PDT 2019
ro created this revision.
ro added reviewers: rsmith, samsonov.
ro added a project: Sanitizers.
Herald added subscribers: Sanitizers, fedor.sergeev, kubamracek, jyknight.
Herald added a project: LLVM.
A couple of `UBSan-* :: TestCases/ImplicitConversion` testcases FAIL on Solaris/x86
(and Solaris/SPARC with https://reviews.llvm.org/D40900):
FAIL: UBSan-AddressSanitizer-i386 :: TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c (49187 of 49849)
******************** TEST 'UBSan-AddressSanitizer-i386 :: TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c' FAILED ********************
[...]
Command Output (stderr):
--
/vol/llvm/src/compiler-rt/local/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c:53:11: error: CHECK: expected string not found in input
// CHECK: {{.*}}signed-integer-truncation-or-sign-change-blacklist.c:[[@LINE-1]]:10: runtime error: implicit conversion from type '{{.*}}' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type '{{.*}}' (aka 'signed char') changed the value to -1 (8-bit, signed)
^
<stdin>:1:1: note: scanning from here
/vol/llvm/src/compiler-rt/local/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c:52:10: runtime error: implicit conversion from type 'uint32_t' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type 'int8_t' (aka 'char') changed the value to -1 (8-bit, signed)
^
<stdin>:1:1: note: with "@LINE-1" equal to "52"
/vol/llvm/src/compiler-rt/local/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c:52:10: runtime error: implicit conversion from type 'uint32_t' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type 'int8_t' (aka 'char') changed the value to -1 (8-bit, signed)
^
<stdin>:1:69: note: possible intended match here
/vol/llvm/src/compiler-rt/local/test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c:52:10: runtime error: implicit conversion from type 'uint32_t' (aka 'unsigned int') of value 4294967295 (32-bit, unsigned) to type 'int8_t' (aka 'char') changed the value to -1 (8-bit, signed)
^
This is always a difference for `int8_t` where `signed char` is expected, but only
`char` seen.
I could trace this to `<sys/int_types.h>` which has
/*
* Basic / Extended integer types
*
* The following defines the basic fixed-size integer types.
*
* Implementations are free to typedef them to Standard C integer types or
* extensions that they support. If an implementation does not support one
* of the particular integer data types below, then it should not define the
* typedefs and macros corresponding to that data type. Note that int8_t
* is not defined in -Xs mode on ISAs for which the ABI specifies "char"
* as an unsigned entity because there is no way to define an eight bit
* signed integral.
*/
#if defined(_CHAR_IS_SIGNED)
typedef char int8_t;
#else
#if defined(__STDC__)
typedef signed char int8_t;
#endif
#endif
`_CHAR_IS_SIGNED` is always defined on both sparc and x86. Since it seems ok
to have either form, I've changed the affected tests to use
`'{{(signed )?}}char'` instead of `'signed char'`.
Tested on `x86_64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and `x86_64-pc-linux-gnu`.
Ok for trunk?
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D63984
Files:
test/ubsan/TestCases/ImplicitConversion/integer-arithmetic-value-change.c
test/ubsan/TestCases/ImplicitConversion/integer-conversion.c
test/ubsan/TestCases/ImplicitConversion/integer-sign-change.c
test/ubsan/TestCases/ImplicitConversion/integer-truncation.c
test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation-or-sign-change-blacklist.c
test/ubsan/TestCases/ImplicitConversion/signed-integer-truncation.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63984.207245.patch
Type: text/x-patch
Size: 82021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/be425072/attachment.bin>
More information about the llvm-commits
mailing list