Re: Why not build kernel with -O3

From: One Thousand Gnomes
Date: Wed Apr 08 2015 - 08:57:35 EST

> I can't remember any off the top of my head, but it does say explicitly
> in the GCC manual to be careful with -O3. IIRC, most of the issues
> relate to -O3 enabling -ffast-math (which tends to really mess with code
> that expects strict IEEE 754 compliance), so it may not be as much of an
> issue for kernel code. You might look into some of the projects that
> use -O3 by default (I think most of the Mozilla so0ftware does these
> days, and I know that there are others, I just can't remember what right
> now).

Historically -O3 used to produce code that used a lot more memory and was
frequently neither correct nor fast. That was however in the days of gcc
2.7.x and I don't know that anyone has taken a hard look at stuff with a
modern gcc.

At the very least I think a -O3 change for x86 as well as being
benchmarked would need to go through all the stress testers and
regression testing build systems we now have to try and catch any

If your numbers are right then it looks well worth investigating.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at