[Fedora-packaging] About optflags

Ralf Corsepius rc040203 at freenet.de
Sun Jan 23 07:03:04 UTC 2011


On 01/22/2011 11:28 PM, Sergio Belkin wrote:
> 2011/1/22 Jason L Tibbitts III<tibbs at math.uh.edu>:
>>>>>>> "SB" == Sergio Belkin<sebelk at gmail.com>  writes:
>>
>> SB>  Is it allowed to override "-O2" and use instead "-O3"? I see that
>> SB>  those flags overrides those CXXFLAGS from Makefile sources.
>>
>> Of course for your personal packages you can do whatever you like.  In
>> Fedora, though, the answer is that you should use the provided optflags
>> unless you have specific justification for a change.  In order to change
>> -O2 to -O3 I'd want to see benchmarking and other such evidence that
>> indicates that the change actually makes a difference.  Otherwise it's
>> just a case of "adding -O99 for uber mega speedz0rs!!!11!!1one".
>>
>>   - J<
>> --
>> packaging mailing list
>
> Thanks for the answer, could you tell me (I'm really no ironic) could
> you tell me when I can find that such a evidence.
Well, I am not sure if I understand correctly.

The problem with -O3 vs. -O2 is -O3 turning on, less-tested agressive 
features, which
* may trip over bugs inside of the compiler (e.g. compiler ICEs).
* may cause mis-compiled/defective binaries.
* may break interaction with other tools (e.g. break debuginfos)


Also, "-O2 vs. -O3" benchmarks are of little significance, because 
individual upstreams have little possibility to know about the 
generality and significance of such benchmarks. I.e. though an upstream 
may be able to prove "-O3 is 5% faster for application XXX on 
Ubuntu-Y-x86_64", this figure doesn't tell much about the impact of "-O3 
on fedora-X-powerpc".

> Let's say that I forget the "-O3" issue. Can I use that CXXFLAGS
>
>   "-ansi  -Wall -Wno-deprecated" ?
-ansi normally doesn't affect code generation, so it's mostly harmless.
-ansi however is somewhat problematic when it comes to portability, 
because the impact of -ansi is not consistent across different OSes.

Adding further warning flags (-W*; not -Wno-* == suppressing warnings) 
is harmless.

Ralf




More information about the packaging mailing list