xref: /llvm-project/compiler-rt/test/asan/TestCases/Windows/integer_divide_by_zero.cpp (revision 3c1aa20c63548c77ddce3dabc7b25c7c7edccaac)
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 
main()8 int main() {
9   puts("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