[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / compiler-rt / test / asan / TestCases / Windows / unsymbolized.cpp
blob00428b809fccd7a5a9f6904a060dbf1a6548707e
1 // When we link a binary without the -debug flag, ASan should print out VAs
2 // instead of RVAs. The frames for main and do_uaf should be above 0x400000,
3 // which is the default image base of an executable.
5 // RUN: rm -f %t.pdb
6 // RUN: %clangxx_asan -c -O2 %s -o %t.obj
7 // RUN: lld-link /nologo /OUT:%t.exe %t.obj -defaultlib:libcmt -nodefaultlib:msvcrt -defaultlib:oldnames %asan_static_runtime_thunk %asan_lib
8 // RUN: not %run %t.exe 2>&1 | FileCheck %s
9 // REQUIRES: lld-available
11 #include <stdlib.h>
12 #include <stdio.h>
13 int __attribute__((noinline)) do_uaf(void);
14 int main() {
15 int r = do_uaf();
16 printf("r: %d\n", r);
17 return r;
19 int do_uaf(void) {
20 char *x = (char*)malloc(10 * sizeof(char));
21 free(x);
22 return x[5];
23 // CHECK: AddressSanitizer: heap-use-after-free
24 // CHECK: #0 {{0x[a-f0-9]+ \(.*[\\/]unsymbolized.cpp.*.exe\+(0x40|0x14000)[a-f0-9]{4}\)}}
25 // CHECK: #1 {{0x[a-f0-9]+ \(.*[\\/]unsymbolized.cpp.*.exe\+(0x40|0x14000)[a-f0-9]{4}\)}}