Commit fc0a52df by Karl Schimpf

Check that address is i32 for indirect calls.

Fixes bug where code did not check that the address of an indirect call must be i32. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4321 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1363983002 .
parent e0b829f8
......@@ -24,7 +24,7 @@
11,1,2,1;
10,2;
2,3,2,1;
34,0,5,0;
34,0,5,1;
2,1,5,0;
65534;
5534;
......
65535,8,2;
1,1;
65535,17,2;
1,5;
2;
21,0,0;
7,32;
3;
21,0,0,2,3;
65534;
8,1,0,1,0;
8,4,0,0,0;
65535,19,2;
5,0;
65534;
65535,14,2;
1,1,102;
1,0,103;
65534;
65535,12,2;
1,1;
44,0,1,0;
10;
65534;
65534;
......@@ -7,7 +7,7 @@
; RUN: -bitcode-format=pnacl -notranslate -build-on-read 2>&1 \
; RUN: | FileCheck %s
; CHECK: Intrinsic llvm.nacl.setjmp expects i32 for argument 1. Found: double
; CHECK: Argument 1 of llvm.nacl.setjmp expects i32. Found: double
; RUN: pnacl-bcfuzz -bitcode-as-text \
; RUN: %p/Inputs/bad-intrinsic-arg.tbc -output - \
......
......@@ -10,6 +10,6 @@ declare void @f(i8);
define void @Test() {
entry:
call void @f(i8 1)
; CHECK: Call argument 1 matches declaration but has invalid type: i8
; CHECK: Argument 1 of f has invalid type: i8
ret void
}
......@@ -10,7 +10,7 @@ declare i1 @f();
define void @Test() {
entry:
%v = call i1 @f()
; CHECK: Return type of called function is invalid: i1
; CHECK: Return type of f is invalid: i1
ret void
}
......@@ -8,6 +8,6 @@ define void @CallIndirectI32(i32 %f_addr) {
entry:
%f = inttoptr i32 %f_addr to i32(i8)*
%r = call i32 %f(i8 1)
; CHECK: Call argument 1 has invalid type: i8
; CHECK: Argument 1 of function has invalid type: i8
ret void
}
; Tests that we check the call address is a pointer on an indirect call.
; REQUIRES: no_minimal_build
; RUN: not %pnacl_sz -bitcode-as-text \
; RUN: %p/Inputs/indirect-call-on-float.tbc \
; RUN: -bitcode-format=pnacl -notranslate -build-on-read 2>&1 \
; RUN: | FileCheck %s
; CHECK: Call indirect address not i32. Found: float
; RUN: pnacl-bcfuzz -bitcode-as-text \
; RUN: %p/Inputs/indirect-call-on-float.tbc -output - \
; RUN: | not pnacl-bcdis -no-records | FileCheck -check-prefix=ASM %s
; ASM: function void @f1(i32 %p0, float %p1) { // BlockID = 12
; ASM: blocks 1;
; ASM: %b0:
; ASM: call void %p1();
; ASM: ret void;
; ASM: }
......@@ -9,11 +9,13 @@
; CHECK: Module valuesymtab not allowed after function blocks
; RUN: pnacl-bcfuzz -bitcode-as-text %p/Inputs/symtab-after-fcn.tbc \
; RUN: -output - | pnacl-bcdis -no-records | FileCheck -check-prefix=ASM %s
; RUN: -output - | not pnacl-bcdis -no-records \
; RUN: | FileCheck -check-prefix=ASM %s
; ASM: module { // BlockID = 8
; ASM: function void @f0() { // BlockID = 12
; ASM: }
; ASM: valuesymtab { // BlockID = 14
; ASM: Error({{.*}}): Module symbol table must appear before function blocks
; ASM: }
; ASM: }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment