Get the latest tech news
Pointers Are Complicated II, or: We need better language specs (2020)
Some time ago, I wrote a blog post about how there’s more to a pointer than meets the eye. One key point I was trying to make is that just because two pointers point to the same address...
The goal is to convince you that to build a correct compiler for languages permitting unsafe pointer manipulation such as C, C++, or Rust, we need to take IR semantics (and specifically provenance) more seriously. Due to this behavior of signed integer overflow, this case of loop-invariant code motion is correct if we consider it as an optimization on programs that are written in LLVM IR. Which brings me to my main conclusion for this post: to avoid the problem of incompatible optimizations, I think we need to take compiler IRs more serious as programming languages in their own right, and give them a precise specification—including all the UB.
Or read this on Hacker News