Add rustc flag to disable mutable no-aliasing optimizations?

:+1: to this. Also, to add. Box<T>, which is rustc's equivalent to std::unique_ptr<T>, uses the same ABI as *mut T by definition, so this is not an issue.

Having multiple competing frontends would be useful in filling spaces that existing frontends don't cover (and are not in scope to be covered). For example, rustc is bootstrapping heckery. If you want it on an novel platform, then you are SOL. It also, as people have metioned, a way to promote the development of a single specification that users can rely upon. Of all languages I use regularily, rust is the only one that does not have an actual specification I can rely upon.

Would you suggest that other (current or future) implementations also support this flag? In that case, you may want (or need) to figure out how exactly the flag affects the implementation of the abstract machine (what implementation-defined or unspecified behaviour does it affect, and how does it extend the language in terms of defining undefined behaviour). Hint: saying that it disables mutable noalias optimizations is not sufficient, because that inherently assumes llvm (which is an incorrect assumption). -fno-strict-aliasing works imo because it can be clearly described how it affects the implementation of the C and C++ abstract machine.

3 Likes