Hacker News new | ask | show | jobs
by fao_ 2488 days ago
No. All optimizations have tradeoffs, if you don't know what it's doing then you cannot know the tradeoffs made. Empirical black-box testing works to a degree, past which it only gives false assurance, as it would in this case.
1 comments

But you can know what's doing. Just have it output the .s/.asm file

You can also look at the flags and the different optimizations you can turn on and off.

MSVC had some issues with C++ compatibility (a long time ago) but overall it is not bad. A compiler that can compile a whole operating system probably has most of its issues ironed out.

> But you can know what's doing. Just have it output the .s/.asm file

That's still black box testing. There ~may be~ almost certainly is hidden state that could mean that the optimization you expect to be applied is not (or an optimization is misapplied) under certain circumstances, and you can't/won't discover this in advance due to those conditions.

> A compiler that can compile a whole operating system probably has most of its issues ironed out.

History has shown this to be mostly wrong, given how many critical bugs have been discovered in GCC since it was capable of compiling linux