#10892: lcalc fails to build with gcc-4.6
------------------------------------------------------------+---------------
 Reporter:  vbraun                                          |         Owner:  
tbd         
     Type:  defect                                          |        Status:  
closed      
 Priority:  major                                           |     Milestone:  
sage-4.7    
Component:  packages                                        |    Resolution:  
fixed       
 Keywords:                                                  |        Author:  
Volker Braun
 Upstream:  Reported upstream. Developers acknowledge bug.  |      Reviewer:  
David Kirkby
   Merged:  sage-4.7.alpha4                                 |   Work_issues:    
          
------------------------------------------------------------+---------------

Old description:

> lcalc fails to build with the gcc-4.6 version in Fedora 15 alpha:
> {{{
> In file included from ../include/Lglobals.h:51:0,
>                  from Lglobals.cc:23:
> /usr/lib/gcc/x86_64-redhat-
> linux/4.6.0/../../../../include/c++/4.6.0/limits: In static member
> function ‘static
>  double std::numeric_limits<double>::min()’:
> /usr/lib/gcc/x86_64-redhat-
> linux/4.6.0/../../../../include/c++/4.6.0/limits:1479:83: error: call of
> overloaded ‘lcalc_to_double(long double)’ is ambiguous
> /usr/lib/gcc/x86_64-redhat-
> linux/4.6.0/../../../../include/c++/4.6.0/limits:1479:83: note:
> candidates are:
> ../include/Lcommon.h:18:15: note: double lcalc_to_double(const Double&)
> ../include/Lcommon.h:29:15: note: double lcalc_to_double(const int&)
> ../include/Lcommon.h:30:15: note: double lcalc_to_double(const long long
> int&)
> ../include/Lcommon.h:31:15: note: double lcalc_to_double(const short
> int&)
> ../include/Lcommon.h:32:15: note: double lcalc_to_double(const char&)
> ../include/Lcommon.h:33:15: note: double lcalc_to_double(const long int&)
> ../include/Lcommon.h:34:15: note: double lcalc_to_double(const unsigned
> int&)
> ../include/Lcommon.h:35:15: note: double lcalc_to_double(const long
> unsigned int&)
> }}}
> The reason is the following code horror from `src/src/include/Lcommon.h`
> (some editing for clarity):
> {{{
> inline double lcalc_to_double(const Double& x) { return x; }
> inline double lcalc_to_double(const double& x) { return x; }
> //inline double lcalc_to_double(const long double& x) { return x; }
> inline double lcalc_to_double(const int& x) { return x; }
> inline double lcalc_to_double(const long long& x) { return x; }
> inline double lcalc_to_double(const short& x) { return x; }
> inline double lcalc_to_double(const char& x) { return x; }
> inline double lcalc_to_double(const long int& x) { return x; }
> inline double lcalc_to_double(const unsigned int& x) { return x; }
> inline double lcalc_to_double(const long unsigned int& x) { return x; }
> #define Int(x) (int)(lcalc_to_double(x))
> #define Long(x) (Long)(lcalc_to_double(x))
> #define double(x) (double)(lcalc_to_double(x))
> }}}
> The last three lines are clearly a bad idea to define before including
> system headers! As a bandaid, I uncommented the `inline double
> lcalc_to_double(const long double& x)`, and it compiles fine now. But
> somebody who is familiar with the codebase should really rewrite lcalc to
> not redefine the `double()` cast, thats just fragile and will sooner or
> later again fail inside some system headers.
>
> My updated spkg is here:
>
> http://www.stp.dias.ie/~vbraun/Sage/spkg/lcalc-20100428-1.23.p6.spkg
>
> It would be nice if we could update the spkg before Fedora 15 is
> released!

New description:

 lcalc fails to build with the gcc-4.6 version in Fedora 15 alpha:
 {{{
 In file included from ../include/Lglobals.h:51:0,
                  from Lglobals.cc:23:
 /usr/lib/gcc/x86_64-redhat-
 linux/4.6.0/../../../../include/c++/4.6.0/limits: In static member
 function ‘static
  double std::numeric_limits<double>::min()’:
 /usr/lib/gcc/x86_64-redhat-
 linux/4.6.0/../../../../include/c++/4.6.0/limits:1479:83: error: call of
 overloaded ‘lcalc_to_double(long double)’ is ambiguous
 /usr/lib/gcc/x86_64-redhat-
 linux/4.6.0/../../../../include/c++/4.6.0/limits:1479:83: note: candidates
 are:
 ../include/Lcommon.h:18:15: note: double lcalc_to_double(const Double&)
 ../include/Lcommon.h:29:15: note: double lcalc_to_double(const int&)
 ../include/Lcommon.h:30:15: note: double lcalc_to_double(const long long
 int&)
 ../include/Lcommon.h:31:15: note: double lcalc_to_double(const short int&)
 ../include/Lcommon.h:32:15: note: double lcalc_to_double(const char&)
 ../include/Lcommon.h:33:15: note: double lcalc_to_double(const long int&)
 ../include/Lcommon.h:34:15: note: double lcalc_to_double(const unsigned
 int&)
 ../include/Lcommon.h:35:15: note: double lcalc_to_double(const long
 unsigned int&)
 }}}
 The reason is the following code horror from `src/src/include/Lcommon.h`
 (some editing for clarity):
 {{{
 inline double lcalc_to_double(const Double& x) { return x; }
 inline double lcalc_to_double(const double& x) { return x; }
 //inline double lcalc_to_double(const long double& x) { return x; }
 inline double lcalc_to_double(const int& x) { return x; }
 inline double lcalc_to_double(const long long& x) { return x; }
 inline double lcalc_to_double(const short& x) { return x; }
 inline double lcalc_to_double(const char& x) { return x; }
 inline double lcalc_to_double(const long int& x) { return x; }
 inline double lcalc_to_double(const unsigned int& x) { return x; }
 inline double lcalc_to_double(const long unsigned int& x) { return x; }
 #define Int(x) (int)(lcalc_to_double(x))
 #define Long(x) (Long)(lcalc_to_double(x))
 #define double(x) (double)(lcalc_to_double(x))
 }}}
 The last three lines are clearly a bad idea to define before including
 system headers! As a bandaid, I uncommented the `inline double
 lcalc_to_double(const long double& x)`, and it compiles fine now. But
 somebody who is familiar with the codebase should really rewrite lcalc to
 not redefine the `double()` cast, thats just fragile and will sooner or
 later again fail inside some system headers.

 '''Updated spkg''':
 
[http://boxen.math.washington.edu/home/jdemeyer/spkg/lcalc-20100428-1.23.p6.spkg]

--

Comment(by jdemeyer):

 `www.stp.dias.ie` seems to be down, so I'm mirroring the spkg myself.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10892#comment:8>
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