Assertion error in APInt.cpp

Hi all,
I’m experimenting with the Interpreter and all look good so far :slight_smile: Unfortunately when I play with the visitBinartOperator() method I have the following assertion error:

Support/APInt.cpp:233: llvm::APInt llvm::APInt::operator*(const llvm::APInt &) const: Assertion `BitWidth == RHS.BitWidth && “Bit widths must be the same”’ failed.

I have recompiled llvm and printer the 2 widths. BitWidth is 1 and RHS.BitWidth is 32.

I would clarify that in the visitBinaryOperator() I just call Interpreter::visitBinaryOperator(I) and I do not perform any other operation.

Can you imagine any reason why this error happens? I have attached the file I used for having the error.

Thanks

fourth.c (160 Bytes)

Hi all,
I'm experimenting with the Interpreter and all look good so far :slight_smile: Unfortunately when I play with the visitBinartOperator() method I have the following assertion error:

Support/APInt.cpp:233: llvm::APInt llvm::APInt::operator*(const llvm::APInt &) const: Assertion `BitWidth == RHS.BitWidth && "Bit widths must be the same"' failed.

I have recompiled llvm and printer the 2 widths. BitWidth is 1 and RHS.BitWidth is 32.

I would clarify that in the visitBinaryOperator() I just call Interpreter::visitBinaryOperator(I) and I do not perform any other operation.

Can you imagine any reason why this error happens? I have attached the file I used for having the error.

I would guess because

BitWidth is 1 and RHS.BitWidth is 32.

which is what it said in the assertion message.
It is up to the API user to uphold that requirement.

Thanks

Roman.

Hi Roman,
Thanks for your email. I understand the error but I cannot understand why the sizes are different considering I’m just calling visitBinaryOperator with the original instruction as parameter.

Thanks