Talk:GCC optimization

Suggestions about where to link new users
I find this page very instructive, and I just want to share/discuss a couple observations about the evolution of this advice.

First, it seems that this page is intended to serve users at both beginner (it takes the time to explain what CFLAGS are) and advanced (it is aimed at optimization and warns of unintended consequences of failed attempts at optimization) levels of familiarity with the subject.

Second, I note that the Handbook now refers all users to the gnu gcc manual (which, though great background, is not focused on the task at hand during the installation process). So, the Handbook also refers all users to this page, whereas I think it used to refer users to Safe_CFLAGS instead of this.

Comparing this page with the Safe_CFLAGS page, I see that there is different advice about how to get gcc to tell you what CFLAGS you should set.

Recommendation: perhaps, if the Safe_CFLAGS page is relevant, some of the less familiar users would be better served by it than the more detailed discussion on this page, and we could include in this page a reference to the Safe_CFLAGS page.

See also this forum discussion. brendlefly62 (talk) 17:59, 23 January 2017 (UTC)


 * Thanks for the effort you put into writing this up. I'll check into where we're currently linking new users and try to make our linking ideal. Kind regards, --Maffblaster (talk) 22:47, 11 May 2017 (UTC)

What about -flto?
The page doesn't say anything about link-time optimization or the -flto flag. I was looking at the optimization flags in the GCC manual and it looked pretty important, so I'm surprised this page doesn't have any advice about whether/how it should be used in Gentoo.Nlburgin (talk) 23:05, 6 August 2017 (UTC)


 * A section about LTO has been added to the article. Fturco (talk) 14:07, 2 June 2020 (UTC)

Optimizations equal or greater than 3
I can no longer find the following piece of code in gcc/opts.c:

Should we remove it from the article?

Fturco (talk) 16:21, 7 August 2018 (UTC)


 * Updated. --Grknight (talk) 02:33, 8 November 2018 (UTC)