Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with -Wall and Property Tree
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2010-06-08 10:44:55


On Tue, 8 Jun 2010 12:23:03 +0200, José Tomás Tocino García
<theom3ga_at_[hidden]> wrote:
> cout << myTree.get<float>("sonido.limite", 0.);
>
> If I compile using "g++ -o program testcase1.cpp -I." I get no errors,
but
> if I add "-Wall", I get:
>
> ./boost/property_tree/detail/ptree_implementation.hpp: In function ‘int
> main(int, char**)’:
> ./boost/property_tree/detail/ptree_implementation.hpp:728: warning:
> dereferencing pointer ‘default_value’ does break strict-aliasing rules
> /usr/include/boost/optional/optional.hpp:422: note: initialized from
here
>
> What's the problem? It compiles and works properly, but it would be
great
> to
> have a warning-free compilation output.

That's really weird, and looks more like a compiler bug to me than a valid
warning. For sure, 'default_value' is certainly not initialized within
optional.hpp. But then, the strict-aliasing warnings are flow-sensitive and
thus emitted during optimization, which means that GCC's internal view of
the source could be quite seriously messed up by then.

Do you get the warning if you explicitly type the default value correctly,
i.e. use '0.f' instead of '0.'?

Sebastian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net