summaryrefslogtreecommitdiff
path: root/test/ubsan/TestCases/ImplicitConversion/integer-truncation-summary.cpp
blob: a92e01fb4ab6acc5203979f85d096d3b7a9aad88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// RUN: %clangxx -fsanitize=implicit-integer-truncation %s -o %t
// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
// REQUIRES: !ubsan-standalone && !ubsan-standalone-static

#include <stdint.h>

int main() {
  uint8_t t0 = (~(uint32_t(0)));
  // CHECK-NOTYPE: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:16
  // CHECK-TYPE: SUMMARY: UndefinedBehaviorSanitizer: implicit-integer-truncation {{.*}}summary.cpp:[[@LINE-2]]:16
  return 0;
}