Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's the difference between -O3 and (-O2 + flags that man gcc says -O3 adds to -O2)?
    primarykey
    data
    text
    <p>I recently received a bug report about a program which fails to compile with the -O3 switch (see <a href="https://github.com/cschwan/sage-on-gentoo/issues/66" rel="nofollow noreferrer">https://github.com/cschwan/sage-on-gentoo/issues/66</a>). In particular, the problem is that compilation hangs at a certain point. The issue is solved by compiling with -O2 (I am well aware of the fact that programs compiled with -O3 may be broken, but I did not know that -O3 may hangup the compiler). If you want to reproduce the issue run</p> <pre><code>wget http://perso.ens-lyon.fr/xavier.pujol/fplll/libfplll-3.0.12.tar.gz tar -xf libfplll-3.0.12.tar.gz cd libfplll-3.0.12 ./configure CXXFLAGS="-O3" make </code></pre> <p>I wondered why -O3 hangs up the compiler and so I tried to track down the issue. First, I tried to find out the the difference between -O2 between -O3. Gcc's man page states that -O3 enables the switches of -O2 and the following ones (lets call them <code>x</code>):</p> <pre><code>-finline-functions -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize -fipa-cp-clone </code></pre> <p>I verified that by comparing the output of gcc when invoked with <code>-Q -O2 --help=optimizers</code> and <code>-Q -O3 --help=optimizers</code>. I then planned to selectively remove the switches in order to find the one which causes the problem. However, compilation works fine with -O2 and the additional switches above, so I conclude</p> <pre><code>-O3 != -O2 x </code></pre> <p><b>Now my question</b>: Does anybody know if there is a further difference between -O2 and -O3 (undocumented?), has anyone experienced a similar behavior ? Is this maybe a compiler bug ?</p>
    singulars
    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.
 

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