|
Boost : |
From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2007-06-06 13:34:13
Hello Jörg,
Richter, Jörg ha escrito:
> Compiling some code using Boost 1.34.0 and GCC 4.2.0, I get this warning with -O1:
>
> multi_index/ordered_index.hpp: In member function ...multi_index_base_type...insert_
> multi_index/ordered_index.hpp:566 'inf.side' may be used uninitialized in this function
>
> It looks like the only position where inf.side is not initialized is line 830. But I
> can't tell if line 574 will be executed in this case (where inf.side is used)
No, it won't, because in that case, link_point and then hinted_link_point return
false, making insert_ exit at line 568. This warning has already been reported,
please see
http://lists.boost.org/boost-users/2007/02/25815.php
At the time I was reluctant to fix the warning because it's bogus (the supposedly
offending variable is never used uninitialized) and the fix does not have
0 runtime cost (it's abolutely negligible, but anyway.) But as I've received
other complaints on the same issue since the one referred to above, I guess
I'll fix it for the next version of Boost. In the meantime you can shut the compiler
by manually changing lines 798-802:
struct link_info
{
ordered_index_side side;
ordered_index_node_impl* pos;
};
to:
struct link_info
{
link_info():side(to_left){}
ordered_index_side side;
ordered_index_node_impl* pos;
};
Does this make the compiler happy? Thank you for using Boost.MultiIndex,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk