Library ABI seriously broken!!

Richard Guenther richard.guenther@gmail.com
Fri Oct 30 13:09:00 GMT 2009


On Fri, Oct 30, 2009 at 1:54 PM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Jerry Quinn wrote:
>> I've reverted the patch.
>>
> Thanks Jerry for your quick feedback.

I think it was just

 static tree
-tinfo_name (tree type)
+tinfo_name (tree type, bool mark_private)
 {
   const char *name;
+  int length;
   tree name_string;

-  name = mangle_type_string_for_rtti (type);
-  name_string = fix_string_type (build_string (strlen (name) + 1, name));
-  return name_string;
+  name = mangle_type_string (type);
+  length = strlen (name);
+
+  if (mark_private)
+    {
+      /* Inject '*' at beginning of name to force pointer comparison.  */
+      char* buf = (char*) XALLOCAVEC (char, length + 1);
+      buf[0] = '*';
+      memcpy (buf + 1, name, length);
+      name_string = build_string (length + 1, buf);
+    }
+  else
+    name_string = build_string (length, name);
+
+  return fix_string_type (name_string);

where you replaced build_string (strlen (name) + 1, name) with
build_string (strlen (name), name).  I don't know if this renders the
ABIs incompatible, but I doubt it - it would be nice to verify that indeed
just extra '\0's are now missing at the end.

Richard.


> Paolo.
>



More information about the Libstdc++ mailing list