Equivalent types

Hi!

I have this error while building my code:
Assertion failed: ((i >= FTy->getNumParams() || FTy->getParamType(i)
== Params[i]->getType()) && "Calling a function with a bad
signature!")
Actually I'm trying to load functions from .bc file and use them in
the code that I'm building with IRBuilder.

I found that function parameter type is %struct.reValue* and
the type of the value that I'm passing to the function is {i32,i64}*

But these types are quite equivalent, because of the definition:
        %struct.reValue = type { %"struct.reValue::$_44",
%"struct.reValue::$_46" }
        %"struct.reValue::$_44" = type { i32 }
        %"struct.reValue::$_46" = type { i64 }

What is the easiest way to solve this problem?

Thanks,
Andrii

Hi Andrii--

They're not equivalent as far as LLVM is concerned - the parameter type is { { i32 }. { i64 } }* whereas the function is being given a { i32, i64 }*. Probably the easiest way to work around this is a simple bitcast.

Alastair

Andrii Vasyliev wrote:

Hi!

I have this error while building my code:
Assertion failed: ((i >= FTy->getNumParams() || FTy->getParamType(i)
== Params[i]->getType()) && "Calling a function with a bad
signature!")
Actually I'm trying to load functions from .bc file and use them in
the code that I'm building with IRBuilder.

I found that function parameter type is %struct.reValue* and
the type of the value that I'm passing to the function is {i32,i64}*

But these types are quite equivalent, because of the definition:
        %struct.reValue = type { %"struct.reValue::$_44",
%"struct.reValue::$_46" }
        %"struct.reValue::$_44" = type { i32 }
        %"struct.reValue::$_46" = type { i64 }

Not quite. %struct.reValue = type { { i32 }, { i64 } } not { i32, i64 }.

Nick

Thanks! That's it!