fix interaction of null_pointer_is_valid and memory attributes
MODIFY
ir/instr.cpp
ir/instr.cpp
@@ -2206,6 +2206,10 @@ static void check_can_load(State &s, const expr &p0) {
expr readable = p.isLocal() || p.isConstGlobal();
expr nonreadable = false;
+ if (attrs.has(FnAttrs::NullPointerIsValid) &&
+ attrs.mem.canRead(MemoryAccess::Other))
+ readable |= p.isNull();
+
(attrs.mem.canRead(MemoryAccess::Args) ? readable : nonreadable)
|= ptr_only_args(s, p);

ADD
tests/alive-tv/attrs/null_is_valid4.srctgt.ll
+define i8 @src() null_pointer_is_valid {
+ %V = load i8, ptr null
+ ret i8 %V
+}
+
+define i8 @tgt() null_pointer_is_valid memory(read, inaccessiblemem: none) {
+ %V = load i8, ptr null
+ ret i8 %V
+}

fix interaction of null_pointer_is_valid and memory attributes