37 lines · cpp
1// UNSUPPORTED: system-windows2 3// FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=3164// XFAIL: android5 6// RUN: %clangxx -fsanitize=undefined %s -O1 -o %t7 8// Regular run.9// RUN: %run %t -4 2> %t.out10// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.out11 12// Good log_path.13// RUN: rm -f %t.log.*14// RUN: %device_rm -f '%t.log.*'15// RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t -4 2> %t.out16// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.log.*17 18// Run w/o errors should not produce any log.19// RUN: rm -f %t.log.*20// RUN: %device_rm -f '%t.log.*'21// RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t 422// RUN: not cat %t.log.*23 24// FIXME: log_path is not supported on Windows yet.25// XFAIL: target={{.*windows-msvc.*}}26 27#include <stdio.h>28#include <stdlib.h>29int main(int argc, char *argv[]) {30 double a = atof(argv[1]);31 unsigned int ai = (unsigned int) a;32 printf("%f %u\n", a, ai);33 return 0;34}35 36// CHECK-ERROR: runtime error: -4 is outside the range of representable values of type 'unsigned int'37