From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4064 invoked by alias); 23 Jun 2014 17:08:38 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4038 invoked by uid 48); 23 Jun 2014 17:08:34 -0000 From: "af300wsm at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/61588] New: Optimization defaults are not what documentation say they should be Date: Mon, 23 Jun 2014 17:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.4.7 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: af300wsm at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-06/txt/msg01805.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61588 Bug ID: 61588 Summary: Optimization defaults are not what documentation say they should be Product: gcc Version: 4.4.7 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: af300wsm at gmail dot com Created attachment 32988 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32988&action=edit Os settings for gcc 4.4.7 The default settings for optimization levels O2 and Os are not what the documentation say they should be. This is true for gcc 4.4.7 on CentOS 6.5 (it is also true for gcc 4.4.4 on CentOS 6.0). The documentation found here: https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Optimize-Options.html#Optimize-Options shows what is turned on/off between O2 and Os optimization options. Specifically, the documentation implies that Os is O2 but favoring size of the binary over speed. The following are the noted exceptions between Os (off) and O2 (on): - falign-functions - falign-jumps - falign-loops - falign-labels - freorder-blocks - freorder-blocks-and-partition - fprefetch-loop-arrays - ftree-vect-loop-version There are attachments to this bug for the O2 and Os settings for 4.4.4 (CentOS 6.0) and 4.4.7 (CentOS 6.5). As you'll notice with diffing between OS versions, the list is identical (except that in CentOS 6.5, gcc 4.4.7, fstrict-enums exists), and diffing between gcc versions shows only 1 difference: finline-functions. Contrary to the gcc documentation for 4.4.7, all values noted above are enabled except falign-loops, freorder-blocks-and-partition and fprefetch-loop-arrays. Most concerning, however, is that all listed optimization settings between O2 and Os are identical with one exception. The one difference between these two is finline-functions. Oddly, this is *disabled* in O2 and *enabled* in Os. This seems contrary to the stated goal of Os. The attached files were generated with this command: $ gcc -Q -Ox --help=optimizers > # where x is either 2 or s This link, https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Overall-Options.html#Overall-Options , shows the use of the -c option as well. However, I noted this made no difference to the output.