]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ubsan/TestCases/ImplicitConversion/integer-truncation-summary.cpp
Vendor import of compiler-rt trunk r338536:
[FreeBSD/FreeBSD.git] / test / ubsan / TestCases / ImplicitConversion / integer-truncation-summary.cpp
1 // RUN: %clangxx -fsanitize=implicit-integer-truncation %s -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
3 // RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
4 // REQUIRES: !ubsan-standalone && !ubsan-standalone-static
5
6 #include <stdint.h>
7
8 int main() {
9   uint8_t t0 = (~(uint32_t(0)));
10   // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:16
11   // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-truncation {{.*}}summary.cpp:[[@LINE-2]]:16
12   return 0;
13 }