bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gsl] SV decomp failure


From: Steve Brosnan
Subject: Re: [Bug-gsl] SV decomp failure
Date: Wed, 19 Sep 2012 14:46:32 -0700

Hello All,

Since this issue has been around for at least a year, it has been reported 
several times, and I have eagerly read anything related to it on the 'bug' 
feed. The recent suggestion by Rhys, and validated by Peter, that compiler 
optimization could be involved is very helpful. It is consistent with my 
finding that the SV decomp test succeeds on my older Macbook Pro with Core-2 
Duo, but fails for the newer iMac with quad-core i5. Sadly this is not 
definitive since the two machines have different OS's, 10.6.8 for the Macbook 
Pro and 10.7.4 for the iMac. The test was for gsl 1.15 in both cases.

About a year ago I did a SV-decomposition test from within Xcode. I extracted 
the portion of the test suite that relates to SV-decomp and included any files 
necessary to get things to compile. I was hoping to use Xcode's visual debugger 
to see what was going on, but the test ran error free. I was stumped and put it 
aside. Now I have just revisited that test, this time trying various compiler 
optimization settings within Xcode. As Peter reported, -O0 and -O1 were 
error-free, but -O2 failed. (My prior test had used the default -O0 setting.)

None of this is new information for you, but what may be new is that Xcode (and 
the gcc man page) mention a -Os optimization option. When selected within Xcode 
the test is error free. However, if I 'export CFLAGS="-Os -g"' before the gsl 
configure/make/make check sequence, the test fails. Perhaps this means that 
some changes are needed either in 'configure' or 'makefile' to be compatible 
with the newer Macs.

The -Os option is described as "smallest, fastest" in Xcode and this way in the 
gcc man page:

       -Os Optimize for size, but not at the expense of speed.  -Os enables all 
-O2
           optimizations that do not typically increase code size.  However, 
instructions are
           chosen for best performance, regardless of size.  To optimize solely 
for size on
           Darwin, use -Oz (APPLE ONLY).

           The following options are set for -O2, but are disabled under -Os: 
-falign-functions
           -falign-jumps  -falign-loops -falign-labels  -freorder-blocks
           -freorder-blocks-and-partition -fprefetch-loop-arrays  
-ftree-vect-loop-version

           When optimizing with -Os or -Oz (APPLE ONLY) on Darwin, any function 
up to 30
           "estimated insns" in size will be considered for inlining.  When 
compiling C and
           Objective-C sourcefiles with -Os or -Oz on Darwin, functions 
explictly marked with
           the "inline" keyword up to 450 "estimated insns" in size will be 
considered for
           inlining.  When compiling for Apple POWERPC targets, -Os and -Oz 
(APPLE ONLY)
           disable use of the string instructions even though they would 
usually be smaller,
           because the kernel can't emulate them correctly in some rare cases.  
This behavior
           is not portable to any other gcc environment, and will not affect 
most programs at
           all.  If you really want the string instructions, use -mstring.

For completeness here is the man page section for -O2:
 
      -O2 Optimize even more.  GCC performs nearly all supported optimizations 
that do not
           involve a space-speed tradeoff.  The compiler does not perform loop 
unrolling or
           function inlining when you specify -O2.  As compared to -O1, this 
option increases
           both compilation time and the performance of the generated code.

           LLVM-GCC's -O is a synonym for -O2.

           -O2 turns on all optimization flags specified by -O1.  It also turns 
on the
           following optimization flags: -fthread-jumps -fcrossjumping 
-foptimize-sibling-calls
           -fcse-follow-jumps  -fcse-skip-blocks -fgcse  -fgcse-lm 
-fexpensive-optimizations
           -frerun-cse-after-loop -fcaller-saves -fpeephole2 -fschedule-insns
           -fschedule-insns2 -fsched-interblock  -fsched-spec -fregmove 
-fstrict-aliasing
           -fstrict-overflow -fdelete-null-pointer-checks -freorder-blocks  
-freorder-functions
           -falign-functions  -falign-jumps -falign-loops  -falign-labels 
-ftree-vrp -ftree-pre

           Please note the warning under -fgcse about invoking -O2 on programs 
that use
           computed gotos.

           -O2 doesn't turn on -ftree-vrp for the Ada compiler.  This option 
must be explicitly
           specified on the command line to be enabled for the Ada compiler.

           In Apple's version of GCC, -fstrict-aliasing, -freorder-blocks, and
           -fsched-interblock are disabled by default when optimizing.

Note that -Os is a subset of -O2.

That's all I have. I hope that it adds to the discussion.

- Steve


On Sep 19, 2012, at 9:00 AM, address@hidden wrote:

> Date: Tue, 18 Sep 2012 13:17:53 -0300
> From: Peter Lelievre <address@hidden>
> To: Rhys Ulerich <address@hidden>
> Cc: address@hidden
> Subject: Re: [Bug-gsl] SV decomp failure
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset=iso-8859-1
> 
> Looks to be that way. -O1 was fine. -O2 was not. Thanks.
> 
> On 2012-09-18, at 12:41 PM, Rhys Ulerich wrote:
> 
>> Hi Peter,
>> 
>>> I performed the following and the log file (attached) shows no failures.
>>> 
>>> make clean
>>> export CFLAGS="-O0 -g"
>>> ./configure --disable-shared --disable-dependency-tracking
>>> make
>>> make check > log 2>&1
>> 
>> Great!  How about trying -O1?  Also, no need to attach the log file.
>> 
>> This sounds like the test tolerances on these tests are just too strict.
>> 
>> - Rhys
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]