On Sat, Sep 7, 2013 at 4:27 PM, Geoffrey Irving <[email protected]> wrote:

> To clarify why undefined behavior is really bad in practice: if LLVM ever
> detects that your code performs undefined behavior according to the
> standard, it is *designed* to take full advantage of that fact when making
> optimizations.  In other words, all hell will break lose, in potentially
> very complicated and subtle ways.
>
> Geoffrey
>

Note that there's no detection of undefined behaviour or optimizations
based upon it being detected. LLVM simply operates on valid LLVM bytecode,
and if it performs undefined behaviour it is not valid LLVM bytecode. The
optimization passes and code generation will base all of their assumptions
on the invariants provided by the specification, including that null
pointers are never dereferenced.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to