Raise UB when returning from noreturn fn
MODIFY
ir/instr.cpp
ir/instr.cpp
@@ -2248,6 +2248,9 @@ StateValue Return::toSMT(State &s) const {
}
}
+ if (attrs.has(FnAttrs::NoReturn))
+ s.addUB(expr(false));
+
s.addReturn(move(retval));
return {};
}

ADD
tests/alive-tv/attrs/noreturn-fail-6.srctgt.ll
+define void @src() noreturn {
+ ret void
+}
+
+define void @tgt() noreturn {
+ unreachable
+}

Raise UB when returning from noreturn fn (#495)