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

source code of compiler-rt/test/asan/TestCases/Windows/integer_divide_by_zero.cpp