Bug 35081 - abi breakage in typeinfo (4.0.1 -> 4.2.1)
Summary: abi breakage in typeinfo (4.0.1 -> 4.2.1)
Status: RESOLVED DUPLICATE of bug 33678
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.2.1
: P3 blocker
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-04 20:11 UTC by Mike Stump
Modified: 2008-02-04 20:18 UTC (History)
6 users (show)

See Also:
Host: *-apple-darwin*
Target: *-apple-darwin*
Build: *-apple-darwin*
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Stump 2008-02-04 20:11:01 UTC
Someone appears to have blown the g++ abi in gcc-4.2.1 as compared to gcc-4.0.1.  The below patch appears to be needed?  If so, could you please add this to at least *-apple-darwin*.

$ cat patches-4.2.1/typeinfo-abi.patch 
--- gcc-4.2.1/libstdc++-v3/libsupc++/typeinfo	2007-06-26 11:35:42.000000000 -0400
+++ libstdc++-v3/libsupc++/typeinfo	2007-10-08 12:08:44.000000000 -0400
@@ -100,6 +100,15 @@ namespace std 
     bool operator!=(const type_info& __arg) const
     { return !operator==(__arg); }
     
+   // APPLE LOCAL begin
+   // For ABI stability these virtuals must be ordered: __is_pointer_p, __is_function_p, __do_catch, __do_upcast
+
+   // Return true if this is a pointer type of some kind
+    virtual bool __is_pointer_p() const;
+
+    // Return true if this is a function type
+    virtual bool __is_function_p() const;
+
     // Try and catch a thrown type. Store an adjusted pointer to the
     // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then
     // THR_OBJ points to the thrown object. If THR_TYPE is a pointer
@@ -113,11 +122,7 @@ namespace std 
     virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
 			     void **__obj_ptr) const;
 
-   // Return true if this is a pointer type of some kind
-    virtual bool __is_pointer_p() const;
-
-    // Return true if this is a function type
-    virtual bool __is_function_p() const;
+   // APPLE LOCAL end
 
   protected:
     const char *__name;


It went in with:

r126016 | bkoz | 2007-06-26 04:01:15 -0700 (Tue, 26 Jun 2007) | 13 lines

2007-06-26  Benjamin Kosnik  <bkoz@redhat.com>

        * include/ext/throw_allocator.h: Fixes for -fno-exceptions.
        * testsuite/util/testsuite_shared.cc: Same.
        * testsuite/util/io/illegal_input_error.hpp: Same.
        * testsuite/util/io/verified_cmd_line_input.cc: Same.

        * libsupc++/typeinfo (type_info): Correct comment formatting,
        clarify member access and public interface.
        * libsupc++/exception: Less compressed comments.
        * libsupc++/new: Same.

$ svn diff -c126016 typeinfo
Index: typeinfo
===================================================================
--- typeinfo	(revision 126015)
+++ typeinfo	(revision 126016)
@@ -93,25 +93,12 @@
   class type_info 
   {
   public:
-    /** Destructor. Being the first non-inline virtual function, this
+    /** Destructor first. Being the first non-inline virtual function, this
      *  controls in which translation unit the vtable is emitted. The
      *  compiler makes use of that information to know where to emit
      *  the runtime-mandated type_info structures in the new-abi.  */
     virtual ~type_info();
 
-  private:
-    /// Assigning type_info is not supported.  Made private.
-    type_info& operator=(const type_info&);
-    type_info(const type_info&);
-    
-  protected:
-    const char *__name;
-    
-  protected:
-    explicit type_info(const char *__n): __name(__n) { }
-    
-  public:
-    // the public interface
     /** Returns an @e implementation-defined byte string; this is not
      *  portable between compilers!  */
     const char* name() const
@@ -119,6 +106,7 @@
 
 #if !__GXX_TYPEINFO_EQUALITY_INLINE
     bool before(const type_info& __arg) const;
+
     // In old abi, or when weak symbols are not supported, there can
     // be multiple instances of a type_info object for one
     // type. Uniqueness must use the _name value, not object address.
@@ -133,19 +121,13 @@
     // and therefore address comparisons are sufficient.
     bool before(const type_info& __arg) const
     { return __name < __arg.__name; }
+
     bool operator==(const type_info& __arg) const
     { return __name == __arg.__name; }
 #endif
     bool operator!=(const type_info& __arg) const
     { return !operator==(__arg); }
     
-    // the internal interface
-  public:
-    // return true if this is a pointer type of some kind
-    virtual bool __is_pointer_p() const;
-    // return true if this is a function type
-    virtual bool __is_function_p() const;
-
     // Try and catch a thrown type. Store an adjusted pointer to the
     // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then
     // THR_OBJ points to the thrown object. If THR_TYPE is a pointer
@@ -155,9 +137,25 @@
     virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj,
 			    unsigned __outer) const;
 
-    // internally used during catch matching
+    // Internally used during catch matching
     virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
 			     void **__obj_ptr) const;
+
+   // Return true if this is a pointer type of some kind
+    virtual bool __is_pointer_p() const;
+
+    // Return true if this is a function type
+    virtual bool __is_function_p() const;
+
+  protected:
+    const char *__name;
+    
+    explicit type_info(const char *__n): __name(__n) { }
+    
+  private:
+    /// Assigning type_info is not supported.
+    type_info& operator=(const type_info&);
+    type_info(const type_info&);
   };
 
   /**
@@ -169,9 +167,11 @@
   {
   public:
     bad_cast() throw() { }
+
     // This declaration is not useless:
     // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
     virtual ~bad_cast() throw();
+
     // See comment in eh_exception.cc.
     virtual const char* what() const throw();
   };
@@ -181,9 +181,11 @@
   {
   public:
     bad_typeid () throw() { }
+
     // This declaration is not useless:
     // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
     virtual ~bad_typeid() throw();
+
     // See comment in eh_exception.cc.
     virtual const char* what() const throw();
   };

?
Comment 1 Andrew Pinski 2008-02-04 20:18:48 UTC
And it has already been fixed in 4.2.2.

*** This bug has been marked as a duplicate of 33678 ***