#11084: Singular 3-1-1-4.p4 fails to build with gcc 4.6.0.
----------------------------------------------------------------------------------------+
   Reporter:  drkirkby                                                          
        |       Owner:  GeorgSWeber                                 
       Type:  defect                                                            
        |      Status:  positive_review                             
   Priority:  critical                                                          
        |   Milestone:  sage-4.7                                    
  Component:  build                                                             
        |    Keywords:                                              
     Author:  David Kirkby                                                      
        |    Upstream:  None of the above - read trac for reasoning.
   Reviewer:  AlexanderDreyer                                                   
        |      Merged:                                              
Work_issues:  Testing on  Linux, OS X, Solaris 10 (both x86 and SPARC) with gcc 
4.6.0.  |  
----------------------------------------------------------------------------------------+

Comment(by drkirkby):

 Replying to [comment:19 jdemeyer]:
 > Replying to [comment:17 AlexanderDreyer]:
 > > This seems to be the right solution
 >
 > I completely disagree.  Dropping the optimization is at best a
 workaround.

 Agreed.

 >  IMHO it can ''never'' be "the right solution".  It means that either
 the compiler or the code has a bug.  Maybe dropping the optimization to
 `-O2` covers up any issues, but I think one should really investigate what
 the true problem is.


 Well, a lot of the code in Sage is very difficult to navigate. Sage
 developers did not write it. Much is incomprehensible. Most gives a lot of
 compiler warnings. Sorting out if a gcc bug or a bug in the code is
 difficult. Then if it is a bug in the code, finding where is often very
 very difficult. One could spend ages on it.


 > I am ''very strongly'' against saying to never increase the optimization
 level to `-O3`.  If some later upstream version has fixed this problem, we
 ''should'' increase the optimization level back to `-O3`.

 Given this code has caused many issues on many platforms with optimization
 issues, then I think not increasing it is worthwhile. It should also be
 realised that -O3 does not necessarily run faster than -O2. The higher
 optimization level invokes more speculative optimisations, which may cause
 the code to run slower. See this point from a GCC developer.

 http://gcc.gnu.org/ml/gcc-help/2010-07/msg00190.html


 --------
 ''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.''

 ''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. ''
 ------

 So in summary
  * The upstream developers use -O2
  * Both -O2 and -O3 can cause problems with bad code.
  * -O3 can be slower than -O2
  * Previous attempts to use -O3 have caused problems on numerous platforms
    * Fedora
    * OpenSUSE on Itanium
    * gcc on any platform
  * Just for good measure, the code can't be compiled with the Sun
 compiler, as it has hard-coded uses gcc-specific flags, so we can't even
 get a second opinion about doggy lines of code.
  * Finding whether it's a gcc bug or a bug in Singular would take quite a
 bit of effort, and IMHO would be better spent elsewhere.

 There seems to be little appetite among the Sage community for
 investigating (and possibly fixing) the '''thousands''' of compiler
 warnings - some of which look potentially serious to me. To me at least,
 permitting -O3 on code which has caused numerous issues in the past is
 unwise.

 Dave

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11084#comment:20>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to