From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12890 invoked by alias); 1 Nov 2009 05:02:26 -0000 Received: (qmail 12778 invoked by uid 22791); 1 Nov 2009 05:02:25 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 01 Nov 2009 05:02:20 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nA152IPZ011100; Sun, 1 Nov 2009 01:02:18 -0400 Received: from [IPv6:::1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nA152H9r018559; Sun, 1 Nov 2009 01:02:18 -0400 Message-ID: <4AED1659.70905@redhat.com> Date: Sun, 01 Nov 2009 05:02:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5pre) Gecko/20091029 Shredder/3.0pre MIME-Version: 1.0 To: Jerry Quinn CC: Jakub Jelinek , GCC , "gcc-patches@gcc.gnu.org" Subject: Re: enable-build-with-cxx bootstrap compare broken by r149964 References: <1250345548.19163.155.camel@cerberus.qb5.org> <4A960A78.8040704@redhat.com> <1251694626.7629.2.camel@cerberus.qb5.org> <4AAE6745.3070706@redhat.com> <4AB7B28E.7030501@redhat.com> <1253617474.4274.2795.camel@cerberus.qb5.org> <4AB8D3D1.8010704@redhat.com> <1253712164.4274.2800.camel@cerberus.qb5.org> <4ABA391C.2050903@redhat.com> <1256357452.31533.131.camel@cerberus.qb5.org> <20091026111448.GZ14664@tyan-ft48-01.lab.bos.redhat.com> <4AE5A9F4.30703@redhat.com> <1256729385.31256.445.camel@cerberus.qb5.org> <4AE864AD.30400@redhat.com> <1256792815.31256.1472.camel@cerberus.qb5.org> <4AE92982.4080308@redhat.com> In-Reply-To: <4AE92982.4080308@redhat.com> Content-Type: multipart/mixed; boundary="------------060008080602070800020306" Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-11/txt/msg00001.txt.bz2 This is a multi-part message in MIME format. --------------060008080602070800020306 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 54 Here's the fix I'm checking in for the * path. Jason --------------060008080602070800020306 Content-Type: text/x-patch; name="tinfo-null.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tinfo-null.patch" Content-length: 1506 commit 16463ef55164d4668d6f1eeb150974452e1dbe58 Author: Jason Merrill Date: Sat Oct 31 18:10:17 2009 -0400 * rtti.c (tinfo_name): Fix lengths for private case. diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 2926f97..c7af74a 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -364,10 +364,10 @@ tinfo_name (tree type, bool mark_private) if (mark_private) { /* Inject '*' at beginning of name to force pointer comparison. */ - char* buf = (char*) XALLOCAVEC (char, length + 1); + char* buf = (char*) XALLOCAVEC (char, length + 2); buf[0] = '*'; - memcpy (buf + 1, name, length); - name_string = build_string (length + 1, buf); + memcpy (buf + 1, name, length + 1); + name_string = build_string (length + 2, buf); } else name_string = build_string (length + 1, name); diff --git a/gcc/testsuite/g++.dg/rtti/typeid9.C b/gcc/testsuite/g++.dg/rtti/typeid9.C new file mode 100644 index 0000000..381252d --- /dev/null +++ b/gcc/testsuite/g++.dg/rtti/typeid9.C @@ -0,0 +1,21 @@ +// Test that the typeid name for a local class is properly null-terminated. +// { dg-do run } + +#include +#include +#include + +int f() +{ + struct A {}; struct B {}; + const std::type_info &ti = typeid(A); + const std::type_info &ti2 = typeid(B); + puts (ti.name()); + puts (ti2.name()); + return strcmp (ti.name(), "Z1fvE1A") || strcmp (ti2.name(), "Z1fvE1B"); +} + +int main() +{ + return f(); +} --------------060008080602070800020306--