[klee-dev] Generate a negative constant expression

Zhongqiu Gao zhongqiu_gao at 126.com
Mon Oct 21 17:38:55 BST 2019


Hi Martin,
Thanks for the reply! I checked the Api again and found the information you mentioned. And I found another way, which is(suppose value < 0):
ref<ConstantExpr> value_expr = ConstantExpr::create(-value, 32);
vv = vv.get() -> Neg();
It seems to work too, the value vv will be converted into the corresponding unsigned number.


Best,
Zhongqiu Gao




At 2019-10-21 23:47:34, "Nowack, Martin" <m.nowack at imperial.ac.uk> wrote:
Hi,


In your case, use the `ConstantExpr::alloc()` method that takes an `llvm::APInt` as argument.
There are several `APInt` constructors that allow to create arbitrary signed/unsigned integers (e.g. http://llvm.org/doxygen/classllvm_1_1APInt.html#a6286f2ba84c5ad11f4a90d57cb1dd293).


Best,
Martin



On 19. Oct 2019, at 03:16, Zhongqiu Gao <zhongqiu_gao at 126.com> wrote:


Hi,
I am trying to do some concrete execution by adding a constraint to a path. I check the api of ConstantExpr::create(), and its argument should be an unsigned number. Is there a way to create a negative constant expression?


Thanks,
Zhongqiu Gao



 

_______________________________________________
klee-dev mailing list
klee-dev at imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the klee-dev mailing list