<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 10, 2017 at 11:42 AM, Hal Finkel via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 07/10/2017 01:36 PM, Peter Lawrence wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Chris,<br>
           nice segue to Swift !  :-),   but...<br>
<br>
The question is what should LLVM do with UB in general, saying that<br>
we are going to change one specific idiom from undefined to defined glosses<br>
over the real question: why should we ever optimize / delete any UB at all ?<br>
<br>
This “depressing and faintly terrifying thing” as you call it, should be viewed not as<br>
an opportunity for optimization, but rather as the source of bugs that need to be<br>
warned about at the very least.<br>
<br>
The current action is to delete UB (without warning), is that really right ?<br>
Who can possibly benefit from this optimization ?<br>
And how can that ever outweigh the harm in not reporting an error ?<br>
Why are we expending any effort at all to optimize something that just<br>
about everyone agrees should always be avoided ?<br>
<br>
These last questions are all rhetorical so no need to answer them, the problem<br>
as I see it now is that everyone CC'ed on this email probably by now would agree<br>
privately that optimizing away undefined behavior is wrong, but no one wants<br>
to be the first to say so publicly.<br>
</blockquote>
<br>
I'm certain this hypothesis is false.<br></blockquote><div><br></div><div>It's definitely false.</div><div>I think it's quite right to optimize way undefined behavior.</div><div><br></div><div>I'm in the camp of "if you want better programming languages, take full advantage of what you can in the current ones, and if people don't like it, awesome, let them use a language that has more guarantees".</div><div><br></div><div>(Though i'm usually in the camp of using flags and defaults to achieve this, since i'm somewhat pragmatic)</div><div><br></div><div>If you don't take advantage at all, or only of some things, in the name of pragmatics, now every compiler does something different, and users can't even know what to expect.</div><div><div><br class="gmail-Apple-interchange-newline">In practice, taking advantage is also the only way this stuff gets fixed. It becomes enough of a pain that either later revisions of the same programming language, or a new programming language, fix it.</div></div><div><br></div><div>I'm emphatically not a fan of "well, the language designers suck at giving users what they want and need, so we should fix it for them in the compiler".  Down this path, madness lies.</div><div><br></div><div>Instead, i'd rather make these folks do their job ;)</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div>