public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How safe is gcc -O3 ?
@ 2010-07-20  2:05 Dr. David Kirkby
  2010-07-20  2:35 ` NightStrike
  2010-07-20 14:30 ` Ian Lance Taylor
  0 siblings, 2 replies; 4+ messages in thread
From: Dr. David Kirkby @ 2010-07-20  2:05 UTC (permalink / raw)
  To: gcc-help

gcc is used to build the Sage maths software

http://www.sagemath.org/

There is one fairly large part (Pari)

http://pari.math.u-bordeaux.fr/

where it has been proposed to compile Pari with -O3, rather than the -O1 it is 
the case.

It was changed to -O1 after there were issues on a year-old version of Fedora 
with one particular gcc version, but the feeling is that one should not use -O1 
for everyone.

How safe is it to distribute code for others to build, where you have selected 
-O3 for them? I'm a bit concerned that might be a bit aggressive to use as a 
default, given it will potentially be compiled by different gcc versions on 
different platforms.

I believe -O2 might be a more sensible default, but would welcome the opinions 
of others on the matter.

One thing to bear in mind, is that there is a fairly extensive test suite with 
the software (Sage has a lot of checks of Pari).

Dave

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How safe is gcc -O3 ?
  2010-07-20  2:05 How safe is gcc -O3 ? Dr. David Kirkby
@ 2010-07-20  2:35 ` NightStrike
  2010-07-20  8:08   ` Dr. David Kirkby
  2010-07-20 14:30 ` Ian Lance Taylor
  1 sibling, 1 reply; 4+ messages in thread
From: NightStrike @ 2010-07-20  2:35 UTC (permalink / raw)
  To: Dr. David Kirkby; +Cc: gcc-help

On Mon, Jul 19, 2010 at 8:51 PM, Dr. David Kirkby
<david.kirkby@onetel.net> wrote:
> One thing to bear in mind, is that there is a fairly extensive test suite
> with the software (Sage has a lot of checks of Pari).

Do you have any testsuite failures when using O3?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How safe is gcc -O3 ?
  2010-07-20  2:35 ` NightStrike
@ 2010-07-20  8:08   ` Dr. David Kirkby
  0 siblings, 0 replies; 4+ messages in thread
From: Dr. David Kirkby @ 2010-07-20  8:08 UTC (permalink / raw)
  To: gcc-help

On 07/20/10 03:04 AM, NightStrike wrote:
> On Mon, Jul 19, 2010 at 8:51 PM, Dr. David Kirkby
> <david.kirkby@onetel.net>  wrote:
>> One thing to bear in mind, is that there is a fairly extensive test suite
>> with the software (Sage has a lot of checks of Pari).
>
> Do you have any testsuite failures when using O3?
>

At this point in time, only very few people have tried the code with -O3. I 
assume none of them have, but that's not a lot of people.

Dave

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How safe is gcc -O3 ?
  2010-07-20  2:05 How safe is gcc -O3 ? Dr. David Kirkby
  2010-07-20  2:35 ` NightStrike
@ 2010-07-20 14:30 ` Ian Lance Taylor
  1 sibling, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2010-07-20 14:30 UTC (permalink / raw)
  To: Dr. David Kirkby; +Cc: gcc-help

"Dr. David Kirkby" <david.kirkby@onetel.net> writes:

> How safe is it to distribute code for others to build, where you have
> selected -O3 for them? I'm a bit concerned that might be a bit
> aggressive to use as a default, given it will potentially be compiled
> by different gcc versions on different platforms.

The -O3 optoin should be safe for correct code.  An important difference
between -O2/-O3 and -O1 is that -O2 and -O3 enable strict aliasing and
strict overflow.  Those options provide better optimization for correct
code, but are far more likely to cause unexpected code generation for
incorrect code.  See the -fstrict-aliasing and -fstrict-overflow
options.

> I believe -O2 might be a more sensible default, but would welcome the
> opinions of others on the matter.

The main difference between -O3 and -O2 is that -O3 enables more
speculative optimizations.  These should not miscompile your code, but
they may cause your program to run more slowly.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-20  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-20  2:05 How safe is gcc -O3 ? Dr. David Kirkby
2010-07-20  2:35 ` NightStrike
2010-07-20  8:08   ` Dr. David Kirkby
2010-07-20 14:30 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).