[LLVMdev] mismatched function signatures

Jianzhou Zhao jianzhou at seas.upenn.edu
Wed Jul 20 21:26:26 PDT 2011


Hi,

Suppose I have a function

define void @foo(i4 %a) {
  %ptr = alloca i4
  store i4 %a, i4* %ptr
  ...
}

but in the following the function is used by a wrong signature,

%f = bitcast void(i4)* @foo to void(i8)*
call void %f (i8 17)

then what is the value of %a when @foo is called, will the 255 be
truncated into a value of i4, for example 1, like what trunc does?

It seems fine if the mismatched types are the types that can work with
trunc or ext. But other types, for example, structs, may not work. In
general, if a parameter is of type t1, and its argument is of type t2,
what value of the argument can we expect? Will it be a random value of
type t2?

Thanks.
-- 
Jianzhou



More information about the llvm-dev mailing list