"Paul Giaccone" <paulg@cinesite.co.uk> wrote in message news:461F7092.3020207@cinesite.co.uk...
I have a bug in my program that looks as though it might be in the macros in test.
The following line gives me a segmentation fault:
BOOST_CHECK_SMALL(var[a][b].first, accuracy);
The variable "var" is of type boost::shared_array<std::pair<double, std::valarray<double> > >, for which memory has been allocated as follows (with variable names disguised):
I might be missing somethig, but doesn't var[a] have a type std::pair<double,std::valarray<double> > so the expression var[a][b] doesn't make sence? ....
Outputting the contents shows they have been set OK (using the same array indices, note), but the segmentation fault occurs when the BOOST_CHECK_SMALL macro is used.
Did the UTF caught the segmentation failt? Did you try to use the debugger and see where does it crash? ...
Is it possible that the BOOST_CHECK_* macros don't work with std::valarray in Boost 1.33.1 for gcc 3.2.3?
BOOST_CHECK_SMALL( x, t ) translates into simple abs(x) < abs(t) I do not see how it could cause any segmentation faults. I might be some code generation bug (I've had several problems with this compiler). Otherwise you will have to dig in yourself with debugger. you could also provide simple example that illustrate the issue and I could try to reproduce it here. Gennadiy