Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / ubsan / TestCases / Misc / log-path_test.cpp
blobffd95a5f9c0bb44ad21f64ae4966a2fe8b96a405
1 // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
2 // XFAIL: android
4 // The globs below do not work in the lit shell.
5 // REQUIRES: shell
7 // RUN: %clangxx -fsanitize=undefined %s -O1 -o %t
9 // Regular run.
10 // RUN: %run %t -4 2> %t.out
11 // RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.out
13 // Good log_path.
14 // RUN: rm -f %t.log.*
15 // RUN: %device_rm -f '%t.log.*'
16 // RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t -4 2> %t.out
17 // RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.log.*
19 // Run w/o errors should not produce any log.
20 // RUN: rm -f %t.log.*
21 // RUN: %device_rm -f '%t.log.*'
22 // RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t 4
23 // RUN: not cat %t.log.*
25 // FIXME: log_path is not supported on Windows yet.
26 // XFAIL: target={{.*windows-msvc.*}}
28 // Issue #41838
29 // XFAIL: sparc-target-arch && target={{.*solaris.*}}
31 #include <stdio.h>
32 #include <stdlib.h>
33 int main(int argc, char *argv[]) {
34 double a = atof(argv[1]);
35 unsigned int ai = (unsigned int) a;
36 printf("%f %u\n", a, ai);
37 return 0;
40 // CHECK-ERROR: runtime error: -4 is outside the range of representable values of type 'unsigned int'