From: Michael Stevens (support-1_at_[hidden])
Date: 2002-06-27 22:18:43
>From: Marc Duflot <m.duflot_at_[hidden]>
>There is a bug in uBLAS that is illustrated with the following code:
> numerics::sparse_vector<double> v (3);
> v(1) = v(0) = 42;
> std::cout << v << std::endl;
>The output of the program is (with g++ 2.95.2 and g++ 3.0.4 on Linux)
>The element v(1) is 0 instead of 42. The bug comes from the fact that
>evaluated before v(0) = 42. The bug is not present with the Intel
>the same platform.
This bug seems to be GCC exclusive, it works fine with MSVC7. I can also
confirm that GCC3.1 shows the same behaviour.
I suspect this to be a GCC bug and nothing to do with uBLAS. Looking at
the execution path confirms this. All uBLAS 'v(x)' does is return a
reference to a double
>Note: there is the same problem with Loki::AssocVector.
This seems to confirm it is a compiler and not a library problem. Anyone
out there know if GCC generaly has problems with returned references?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk