Re: [dev] GCC situation

From: koneu <>
Date: Mon, 24 Nov 2014 21:44:02 +0100


Markus Wichmann wrote:
> compiling with -O3 will result in some broken binaries. Somewhere. Why?

Because -O3 is very aggressive and should NOT be used. Especially not
when compiling/bootstrapping a system. In most cases it makes things
buggier and bigger, in some cases even slower. Use -O2.

> Yes, it's the -O0 that bothers me there. I'd like to debug the code that
> actually runs in production.

Run -O0 in production then.

> One big problem is that at -O3 almost every value is "optimized out".


> the program, and kills the timing, and if I'm debugging a race condition

How do debug printfs kill the timing but GDB doesn't?

> (in the sucky code I have to write at work) that's exactly what I don't

Did your employer tell you to use -O3? If yes, quit your job and never
look back.

> need. Oh, and I'll have to remember to remove them.

printf("value: %#042d", (int)((float)9000.1 + (float)0.9));

Received on Mon Nov 24 2014 - 21:44:02 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 24 2014 - 21:48:09 CET