Files
clang-p2996/compiler-rt/test/asan/TestCases/Windows/integer_divide_by_zero.cpp
Alvin Wong 3c1aa20c63 [asan][test][win] Port trivial tests to not use clang-cl on MinGW
Use clang driver on MinGW where clang-cl is not usable. MSVC target
still uses clang-cl to minimize changes to existing test runners.

Differential Revision: https://reviews.llvm.org/D147432
2023-04-21 21:25:49 +08:00

19 lines
542 B
C++

// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: %env_asan_opts=handle_sigfpe=1 not %run %t 2>&1 | FileCheck %s
// Test the error output from dividing by zero.
#include <stdio.h>
int main() {
puts("before ud2a");
fflush(stdout);
volatile int numerator = 1;
volatile int divisor = 0;
return numerator / divisor;
}
// CHECK: before ud2a
// CHECK: ERROR: AddressSanitizer: int-divide-by-zero on unknown address [[ADDR:0x[^ ]*]]
// CHECK-SAME: (pc [[ADDR]] {{.*}})
// CHECK-NEXT: #0 {{.*}} in main {{.*}}integer_divide_by_zero.cpp:{{.*}}