[Bug libstdc++/60734] Undefined behavior in g++-v4/bits/stl_tree.h

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 2 11:03:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60734

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-04-02
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The analysis looks right. The static_cast is definitely undefined. You can't
dereference the end() iterator so we don't need a valid pointer, so the
reinterpret_cast is OK.

I'd like to be able to reproduce it though, the toy examples I've tried don't
get the ubsan error.



More information about the Gcc-bugs mailing list