Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The problem is, I want optimizations.. that don't break things. There's -O1 or -O3 but not -Ononewbugs. I don't expect perfection but changing the meaning of memset or collapsing atomic operations is like "settle down".


Every optimization changes the observable behavior of a program in some way. How is the compiler supposed to know which changes you deem acceptable?

Eliminating dead stores (including calls to memcpy whose result is never read) seems like one of the most basic and least objectionable optimizations I can imagine. So, if you’re against eliminating dead stores, what optimizations _are_ you okay with?


> How is the compiler supposed to know which changes you deem acceptable?

It has no idea! Which is why it should settle down.


There's a flag for that: -O0.

What you seem to want is "do all the optimizations, except the ones that contradict what I 'obviously' mean", which is just not possible with current technology.


The set of all the optimizations that do not break any program is very likely empty. So you are happy to break other people programs as long as yours keep working?


I'm pretty happy to leave the optimizations off. Writing the correct data structures matters a lot more than a clever compiler collapsing two commands into one.


But -O3 is suppose to do that. The problem is that there will almost always be bug.

The flag that may allow things to break is -Ofast.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: