ptr2int can't be used on nocapture ptrs
MODIFY
ir/memory.cpp
ir/memory.cpp
@@ -1777,7 +1777,9 @@ void Memory::fillPoison(const expr &bid) {
expr Memory::ptr2int(const expr &ptr) const {
assert(!memory_unused() && observesAddresses());
- return Pointer(*this, ptr).getAddress();
+ Pointer p(*this, ptr);
+ state->addUB(!p.isNocapture());
+ return p.getAddress();
}
expr Memory::int2ptr(const expr &val) const {

ADD
tests/alive-tv/attrs/nocapture-capture.srctgt.ll
+define i64 @src(i8* nocapture %p) {
+ %v = ptrtoint i8* %p to i64
+ ret i64 %v
+}
+
+define i64 @tgt(i8* nocapture %p) {
+ unreachable
+}

ptr2int can't be used on nocapture ptrs (#685)