admin管理员组文章数量:1026989
Does anyone know why I can't just load a pointer to a z3 expression into my memory and then query it again later? When I do I get context errors and it says not to compare these expressions. When i switch *zero with just z it works fine.
i am using clang version 15.0.7 as my compliler.
llvm::DenseMap<llvm::Value*, z3::expr*> map_end_address;
z3::expr x = context->bv_const("x", 32);
z3::expr y = context->bv_const("y", 32);
z3::expr z = context->bv_const("z", 32);
map_end_address->insert({llvm::dyn_cast<llvm::Value>(mallocCallInstruction), &z});
z3::expr *zero = map_end_address->lookup(llvm::dyn_cast<llvm::Value>(mallocCallInstruction));
solver->add(x == 4);
solver->add(y == 2);
solver->add(*zero == z3::shl(x, y));
This is solved by using shared_pointers, but I really wouldn't understand why these resources would already be released if I just write away the pointer to this object to memory.
llvm::DenseMap<llvm::Value*, std::shared_ptr<z3::expr>> map_end_address;
z3::expr x = context->bv_const("x", 32);
z3::expr y = context->bv_const("y", 32);
std::shared_ptr<z3::expr> z = std::make_shared<z3::expr>(context->bv_const("z", 32));
map_end_address.insert({llvm::dyn_cast<llvm::Value>(mallocCallInstruction), z});
z3::expr *zero = map_end_address.lookup(llvm::dyn_cast<llvm::Value>(mallocCallInstruction)).get();
solver->add(x == 4);
solver->add(y == 2);
solver->add(*zero == z3::shl(x, y));
Does anyone know why I can't just load a pointer to a z3 expression into my memory and then query it again later? When I do I get context errors and it says not to compare these expressions. When i switch *zero with just z it works fine.
i am using clang version 15.0.7 as my compliler.
llvm::DenseMap<llvm::Value*, z3::expr*> map_end_address;
z3::expr x = context->bv_const("x", 32);
z3::expr y = context->bv_const("y", 32);
z3::expr z = context->bv_const("z", 32);
map_end_address->insert({llvm::dyn_cast<llvm::Value>(mallocCallInstruction), &z});
z3::expr *zero = map_end_address->lookup(llvm::dyn_cast<llvm::Value>(mallocCallInstruction));
solver->add(x == 4);
solver->add(y == 2);
solver->add(*zero == z3::shl(x, y));
This is solved by using shared_pointers, but I really wouldn't understand why these resources would already be released if I just write away the pointer to this object to memory.
llvm::DenseMap<llvm::Value*, std::shared_ptr<z3::expr>> map_end_address;
z3::expr x = context->bv_const("x", 32);
z3::expr y = context->bv_const("y", 32);
std::shared_ptr<z3::expr> z = std::make_shared<z3::expr>(context->bv_const("z", 32));
map_end_address.insert({llvm::dyn_cast<llvm::Value>(mallocCallInstruction), z});
z3::expr *zero = map_end_address.lookup(llvm::dyn_cast<llvm::Value>(mallocCallInstruction)).get();
solver->add(x == 4);
solver->add(y == 2);
solver->add(*zero == z3::shl(x, y));
本文标签: cZ3 solver context error when expressions are loaded out of memoryStack Overflow
版权声明:本文标题:c++ - Z3 solver context error when expressions are loaded out of memory - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745655369a2161568.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论