|
|
Log in / Subscribe / Register

Open64 5.0 released

Open64 5.0 released

Posted Nov 14, 2011 5:34 UTC (Mon) by rsidd (guest, #2582)
In reply to: Open64 5.0 released by daglwn
Parent article: Open64 5.0 released

I've long been an advocate of having compilers default to their idea of the best optimization strategy (rathern than defaulting to -O0)

Given that compilers are used numerous times during development, and only once (per file) during product delivery, and given that debugging is unreliable or impossible with anything other than -O0, I'm happy with the current default.


to post comments

Open64 5.0 released

Posted Nov 14, 2011 15:29 UTC (Mon) by epa (subscriber, #39769) [Link]

I guess the answer is an --optimize-for-benchmarking flag which instructs the compiler to do the best it can, with no further information given. You could use that flag for building your released executables and it would probably do pretty well, or you could get into -fstrict-beard-alignment to squeeze out a little bit more performance. The point is to have a *single* setting both to give a fair comparison in benchmarks and to give a good enough default for those who don't want to become compiler experts.

For gcc, --optimize-for-benchmarking could be an alias for -O2, or perhaps -O3 or -O1... I'm not sure which, and that is the point.

Open64 5.0 released

Posted Nov 14, 2011 15:47 UTC (Mon) by endecotp (guest, #36428) [Link] (1 responses)

> debugging is unreliable or impossible with anything other than -O0

My experience is that I can normally get enough information to find a bug from a -O3 stack trace. If I can't, then it's possible to fall back to -O0.

I worry more about the possibilities that (a) some warnings aren't shown if optimisation is off, since apparently the data needed to generate the warning is only computed during an optimisation pass, and (b) some errors might only manifest themselves when optimisation is on, e.g. relying on the value of an uninitialised variable, or strict aliasing issues.

Open64 5.0 released

Posted Nov 14, 2011 16:17 UTC (Mon) by epa (subscriber, #39769) [Link]

You might be interested in kcc which is a full specification of the semantics of the C language, made executable. You can run your code under it and it will warn about undefined or implementation-specific behaviours your code is relying on.

Open64 5.0 released

Posted Nov 20, 2011 21:55 UTC (Sun) by BenHutchings (subscriber, #37955) [Link]

...debugging is unreliable or impossible with anything other than -O0...
I'm aware that the GNU toolchain sucks for source-level interactive debugging of optimised code, though this is slowly improving. But so long as you use C then many bugs are due to invoking 'undefined behaviour'. If your program has undefined behaviour then its actual behaviour cannot be understood in terms of the source language and will likely be inconsistent between the 'debug' and optimised build configurations. You have to learn to read assembly and deal with the crappy tools.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds