• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test that calls made through pointers are unchanged by ASan
2
3; REQUIRES: allow_dump
4
5; RUN: %p2i -i %s --args -verbose=inst -threads=0 -fsanitize-address \
6; RUN:     | FileCheck --check-prefix=DUMP %s
7
8define internal i32 @caller(i32 %callee_addr, i32 %arg) {
9  %callee = inttoptr i32 %callee_addr to i32 (i32)*
10  %result = call i32 %callee(i32 %arg)
11  ret i32 %result
12}
13
14; DUMP-LABEL: ================ Initial CFG ================
15; DUMP-NEXT: define internal i32 @caller(i32 %callee_addr, i32 %arg) {
16; DUMP-NEXT: __0:
17; DUMP-NEXT:   %result = call i32 %callee_addr(i32 %arg)
18; DUMP-NEXT:   ret i32 %result
19; DUMP-NEXT: }
20; DUMP-LABEL: ================ Instrumented CFG ================
21; DUMP-NEXT: define internal i32 @caller(i32 %callee_addr, i32 %arg) {
22; DUMP-NEXT: __0:
23; DUMP-NEXT:   %result = call i32 %callee_addr(i32 %arg)
24; DUMP-NEXT:   ret i32 %result
25; DUMP-NEXT: }
26