[Boost-bugs] [Boost C++ Libraries] #11360: Undefined behavior in extended_type_info_typeid default constructor?

Subject: [Boost-bugs] [Boost C++ Libraries] #11360: Undefined behavior in extended_type_info_typeid default constructor?
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-29 12:27:18


#11360: Undefined behavior in extended_type_info_typeid default constructor?
-------------------------------------------------+-------------------------
 Reporter: Martin Schulze | Owner: ramey
  <spam.martin.schulze@…> | Status: new
     Type: Bugs | Component:
Milestone: To Be Determined | serialization
  Version: Boost 1.58.0 | Severity: Problem
 Keywords: |
-------------------------------------------------+-------------------------
 Using the undefined behavior sanitizer I probably hit the same problem as
 #11204

 However, I also got another message:
 {{{
 /usr/include/boost/serialization/extended_type_info_typeid.hpp:87:59:
 runtime error: member call on address 0x0000010adb60 which does not point
 to an object of type 'extended_type_info_typeid'
 0x0000010adb60: note: object has invalid vptr
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00
               ^~~~~~~~~~~~~~~~~~~~~~~
               invalid vptr
 }}}

 Maybe this message triggers the following messages (as described in
 #11204)

 Anyways, in extended_type_info_typeid.hpp I found

 {{{#!cpp
 extended_type_info_typeid() :
         typeid_system::extended_type_info_typeid_0(get_key()) // <--- line
 87
 {
    // ...
 }
   // ...
 const char * get_key() const { // <--- line 108
     return boost::serialization::guid< T >();
 }
 }}}

 As we can see, the member function `get_key` is called to initialize a
 base class.

 According to § 12.6.2.13 of the standard (I am using n3242) calling a
 member function in a ctor-initializer before all base classes have been
 initialized is undefined behavior.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11360>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC