[Bug libstdc++/63345] Multiple undefined behaviors (static_cast<>) in libstdc++-v3/include/bits

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 6 10:13:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63345

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Malcolm Parsons from comment #9)
> Created attachment 38201 [details]
> fix undefined behaviour in stl_tree.h
> 
> (In reply to Jonathan Wakely from comment #8)
> > I believe all the real problems are fixed now.
> 
> Clang 3.8.0 still reports undefined behaviour in stl_tree.h using GCC 5.3.0:
> 
> lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../include/c++/5.3.0/bits/
> stl_tree.h:1910:28: runtime error: upcast of address 0x00000225d260 with
> insufficient space for an object of type 'std::_Rb_tree_node<std::pair<const
> void *const, testing::(anonymous namespace)::MockObjectState> >'
> 0x00000225d260: note: pointer points here
>  00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  60 d2 25 02
> 00 00 00 00  60 d2 25 02
>               ^ 

That's expected, as some of the fixes are only on trunk, not the gcc-5 branch.

> The attached patch fixes it for me.

That seems to be a backport of r223746 from trunk, right? I'll look into
applying that to the gcc-5 branch.


More information about the Gcc-bugs mailing list