<div dir="ltr"><div>On Wed, Apr 18, 2018 at 3:54 PM Tim Northover via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> Despite the name, the flag actually has rather straightforward semantics<br>
> from the compiler's perspective.  From the gcc docs for<br>
> -fdelete-null-pointer-checks: "Assume that programs cannot safely<br>
> dereference null pointers, and that no code or data element resides at<br>
> address zero."  (-fno-delete-null-pointer-checks is the opposite.)<br>
<br>
Ah, now that's quite a bit more palatable. I really should have read<br>
the docs before spouting "my favourite rant #1". Then my main concern<br>
is that we end up with a sufficiently clear (and documented)<br>
definition that we're not promising more than we intend. I get very<br>
grumpy if I can't tell someone with UB that they're Doing It Wrong</blockquote><div><br></div><div>+1 for implementing the feature.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Of the two options, I still think the second is a non-starter.</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Something between the two might be a datalayout flag specifying<br>
addrspace(0) behaviour. It's pretty easy to argue that it'd be good if<br>
code used some kind of<br>
"DataLayout::isPointerIntrinsicallyInvalid(Value *)" for this kind of<br>
thing anyway (rename or relocate at will)</blockquote><div><br></div><div>Whether or not this is put into DataLayout, moving all the null-related addrSpace != 0 checks into an accessor seems like a great idea. Besides this feature request, presumably there's also other uses of non-zero address spaces for which the pointer 0 could usefully be treated as invalid...</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">And the name really is terrible, we should change it if at all feasible</blockquote><div><br></div></div><div class="gmail_quote"><div>Yep. "-<span style="color:rgb(34,34,34);font-family:sans-serif;font-size:13px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">fnull-pointer-is-valid</span>" has been suggested before.</div></div><div class="gmail_quote"><div><br></div></div></div>