Note that there are some explanatory texts on larger screens.

plurals
  1. POGCC compiler options: which set of enabled options is correct?
    primarykey
    data
    text
    <p>I am trying to figure out which compiler options are enabled for GCC (4.7.3, Macports installation on Mac OS X 10.6.8). I know of the following methods:</p> <ol> <li><p>Using the -Q option with a simple input file as suggested by <a href="https://stackoverflow.com/questions/3138335/gcc-4-3-3-compiler-options-enabled-by-default">GCC 4.3.3 compiler options enabled</a>:</p> <pre><code>gcc -Q -v -o hello hello.c </code></pre></li> <li><p>Using the -Q --help=x combination (for values of x, see <a href="http://gcc.gnu.org/onlinedocs/gcc-4.7.3/gcc/Overall-Options.html#index-help-87" rel="nofollow noreferrer">GCC documentation</a>) e.g:</p> <pre><code>gcc -Q --help=target </code></pre></li> <li><p>To see enabled defines:</p> <pre><code>echo "" | gcc -E -dM - | sort </code></pre></li> </ol> <p>However, when I run method 1 and 2 with the same set of optimization options I get two different sets of enabled/disabled options.</p> <pre><code>$ gcc -Q -v -O3 -march=native -o hello hello.c GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 options passed: -v -D__DYNAMIC__ hello.c -march=corei7-avx -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rdrnd -mno-f16c -mno-fsgsbase --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=corei7-avx -fPIC -mmacosx-version-min=10.6.8 -O3 options enabled: -Wnonportable-cfstrings -fPIC -falign-labels -fasynchronous-unwind-tables -fauto-inc-dec -fbranch-count-reg -fcaller-saves -fcombine-stack-adjustments -fcommon -fcompare-elim -fcprop-registers -fcrossjumping -fcse-follow-jumps -fdebug-types-section -fdefer-pop -fdelete-null-pointer-checks -fdevirtualize -fearly-inlining ... </code></pre> <p>whereas</p> <pre><code>$ gcc -Q -O3 -march=native --help=optimizers -falign-functions [enabled] -falign-jumps [enabled] -falign-labels [enabled] -falign-loops [enabled] -fasynchronous-unwind-tables [enabled] -fbranch-count-reg [enabled] -fbranch-probabilities [disabled] -fbranch-target-load-optimize [disabled] -fbranch-target-load-optimize2 [disabled] -fbtr-bb-exclusive [disabled] -fcaller-saves [enabled] -fcombine-stack-adjustments [enabled] -fcommon [enabled] -fcompare-elim [enabled] -fconserve-stack [disabled] -fcprop-registers [enabled] -fcrossjumping [enabled] -fcse-follow-jumps [enabled] -fcx-fortran-rules [disabled] -fcx-limited-range [disabled] -fdata-sections [disabled] -fdce [enabled] -fdefer-pop [enabled] -fdelayed-branch [disabled] -fdelete-null-pointer-checks [enabled] -fdevirtualize [enabled] -fdse [enabled] -fearly-inlining [enabled] ... </code></pre> <p>Looking at options -falign-functions, -falign-jumps, -falign-labels, and -falign-loops Method 2 claims they are all enabled, while Method 1 says only -falign-labels is enabled. Also options -fdce and -fdse are enabled according to Method 2 but not according to Method 1.</p> <p><b>Question</b>: which method should I trust?</p> <p><i>Side note</i>: the list of method 2 is incomplete, because the options are grouped and only the group(s) requested with the --help= option are listed. To see <i>all</i> options in method 2 run:</p> <pre><code>$ gcc -Q -O3 -march=native --help=optimizers --help=target --help=c --help=common --help=warnings | sort </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload