4 ms·
> if you write `a = b + c` you expect the compiler to generate an `add a, b, c` this could be violated even by simple optimizing compilers that do constant pro
by gpderetta 5y ago
> if you write `a = b + c` you expect the compiler to generate an `add a, b, c`
this could be violated even by simple optimizing compilers that do constant propagation or strength reductions.
Again, if you do not want optimizations -O0 is always available.
- mpweiher 5y agoHmmm... "To help ensure that no code explosion occurs for what appears to be a very simple operation" How does constant propagation cause code explosion?
- kps 5y agoThe statement, in context, is a simple illustration of the principle that C operator semantics were defined by the target hardware. Not a treatise on compiler construction.
- naniwaduni 5y agoIt would be nice if optimizing compilers' -O0 weren't completely insane on the assumption that the insanity would get optimized out.
- ErikCorry 5y agoNowhere does anyone guarantee that you won't be hit with nasal demons if you use -O0
- gpderetta 5y agoWell, it is hard to guarantee anything about a bit of code with no defined semantics, you'll have to settle for what O0 gives you.