From: Patrik J. <co...@fa...> - 2010-10-05 18:14:19
|
Hi all, I just tried to compile a blitz program with gcc4.4 -std=c++0x and blitz doesn't work. Just a simple expression like a=expm1(a); where a is an array gives a segmentation fault, because it ends up in an infinite recursion. Apparently expm1(a) resolves to std::expm1<blitz::Array<double, 1> >, which is implemented as return expm1(__type(__x)); however, __type(__x) is apparently just returning x, so we call std::expm1<blitz::Array<double, 1> > over and over until we run out of stack space. Qualifying the operation as blitz::expm1 seems to work normally, but this breaks a huge chunk of code for me. Does anyone know whether this is a bug in the c++0x implementation in gcc 4.4 or? The expm1 implementation in <cmath> looks like: inline float expm1(float __x) { return __builtin_expm1f(__x); } inline long double expm1(long double __x) { return __builtin_expm1l(__x); } template<typename _Tp> inline typename __gnu_cxx::__promote<_Tp>::__type expm1(_Tp __x) { typedef typename __gnu_cxx::__promote<_Tp>::__type __type; return expm1(__type(__x)); } So there is a totally general template implementation of expm1, but I would expect the blitz implementation to be selected over that template. Is there an implicit conversion necessary for the blitz function that makes the match worse than the generic template? Thanks, /Patrik |