[PATCH] D90529: Allow nonnull attribute to accept poison
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 31 15:35:01 PDT 2020
jdoerfert requested changes to this revision.
jdoerfert added a comment.
This revision now requires changes to proceed.
I think we have two choices here:
1. Don't raise UB when "value attributes" are passed a "wrong value", e.g., `null` for a `nonnull` attribute, but make the value poison. Use `nonull` + `noundef` to make it UB.
2. Make all "value attributes" accept poison without raising UB.
I was in the past pushing for 1), I don't have the link handy but we can probably find it. I think the last time I brought this up was the `noundef` discussion actually.
One of my examples was the `gep` one shown in the commit message,
I vaguely remember one where the user "broke the contract" but in a way they would assume to be harmless, e.g., they did not cause any side-effect, maybe something like:
void foo(bool valid, X& x) {
if (!valid) return;
...
}
obj_ptr = null;
foo(obj_ptr != null, *obj_ptr);
I remember @efriedma was not a fan of 1) at the time, unsure if that is still the case with `noundef` in place.
If we don't do 1), we should talk about 2) before we make `nonnull` special. I fail to see the reason it is different from any other (or at least most) "value attributes".
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90529/new/
https://reviews.llvm.org/D90529
More information about the llvm-commits
mailing list