llvm-project/compiler-rt/test/ubsan/TestCases/ImplicitConversion
Rainer Orth 04ea772d5a [ubsan][test] Fix several UBSan-* :: TestCases/ImplicitConversion tests on Solaris
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.

Differential Revision: https://reviews.llvm.org/D63984

llvm-svn: 365303
2019-07-08 09:22:05 +00:00
..
integer-arithmetic-value-change.c [ubsan][test] Fix several UBSan-* :: TestCases/ImplicitConversion tests on Solaris 2019-07-08 09:22:05 +00:00
integer-conversion.c [ubsan][test] Fix several UBSan-* :: TestCases/ImplicitConversion tests on Solaris 2019-07-08 09:22:05 +00:00
integer-sign-change-blacklist.c Adapt UBSan integer truncation tests to NetBSD 2018-11-06 14:18:05 +00:00
integer-sign-change-summary.cpp [compiler-rt][ubsan] Implicit Conversion Sanitizer - integer sign change - compiler-rt part 2018-10-30 21:58:54 +00:00
integer-sign-change.c [ubsan][test] Fix several UBSan-* :: TestCases/ImplicitConversion tests on Solaris 2019-07-08 09:22:05 +00:00
integer-truncation.c [ubsan][test] Fix several UBSan-* :: TestCases/ImplicitConversion tests on Solaris 2019-07-08 09:22:05 +00:00
signed-integer-truncation-blacklist.c Adapt UBSan integer truncation tests to NetBSD 2018-11-06 14:18:05 +00:00
signed-integer-truncation-or-sign-change-blacklist.c [ubsan][test] Fix several UBSan-* :: TestCases/ImplicitConversion tests on Solaris 2019-07-08 09:22:05 +00:00
signed-integer-truncation-or-sign-change-summary.cpp [compiler-rt][ubsan] Implicit Conversion Sanitizer - integer sign change - compiler-rt part 2018-10-30 21:58:54 +00:00
signed-integer-truncation-summary.cpp [compiler-rt][ubsan] Split Implicit Integer Truncation Sanitizer into unsigned and signed checks 2018-10-11 09:09:52 +00:00
signed-integer-truncation.c [ubsan][test] Fix several UBSan-* :: TestCases/ImplicitConversion tests on Solaris 2019-07-08 09:22:05 +00:00
unsigned-integer-truncation-blacklist.c Adapt UBSan integer truncation tests to NetBSD 2018-11-06 14:18:05 +00:00
unsigned-integer-truncation-summary.cpp [compiler-rt][ubsan] Split Implicit Integer Truncation Sanitizer into unsigned and signed checks 2018-10-11 09:09:52 +00:00
unsigned-integer-truncation.c Adapt UBSan integer truncation tests to NetBSD 2018-11-06 14:18:05 +00:00