|
|
|
|
|
by masklinn
166 days ago
|
|
> As if treating uninitialized reads as opaque somehow precludes all optimizations? That's not what these words mean. > There’s a million more sensible things Again, if you don't like compilers leveraging UBs use a non-optimizing compiler. > All I’ve heard amounts to “but it’s allowed by the spec.” I’m not arguing against that. You literally are though. Your statements so far have all been variations of or nonsensical assertions around "why can't I read from uninitialised memory when the spec says I can't do that". > I’m saying a spec that incentivizes this nonsense is poorly designed. Then... don't use languages that are specified that way? It's really not that hard. |
|
> Undef values aren't exactly constants ... they can appear to have different bit patterns at each use.
My claim is simple and narrow: compilers should internally model such values as unspecified, not actively choose convenient constants.
The comment I replied to cited an example where an undef is constant folded into the value required for a conditional to be true. Can you point to any case where that produces a real optimization benefit, as opposed to being a degenerate interaction between UB and value propagation passes?
And to be explicit: “if you don’t like it, don’t use it” is just refusing to engage, not a constructive response to this critique. These semantics aren't set in stone.
[0] https://llvm.org/doxygen/classllvm_1_1UndefValue.html#detail...