Patchwork PATCH: PR other/42602: demangler doesn't completely demangle a global constructors symbol

login
register
mail settings
Submitter H.J. Lu
Date Nov. 16, 2010, 7:55 p.m.
Message ID <AANLkTikp8g5YCEkRtcrH=azheHOKkevMBiYBdfsA67Rc@mail.gmail.com>
Download mbox | patch
Permalink /patch/71448/
State New
Headers show

Comments

H.J. Lu - Nov. 16, 2010, 7:55 p.m.
On Tue, Nov 16, 2010 at 9:40 AM, Ian Lance Taylor <iant@google.com> wrote:
> On Sat, Jan 9, 2010 at 10:42 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>
>> 2010-01-09  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>        PR other/42602
>>        * cp-demangle.c (d_make_demangle_mangled_name): New.
>>        (d_demangle_callback): Use it on DCT_GLOBAL_XTORS.
>>
>>        * testsuite/demangle-expected: Updated.
>
>> +/* Add a new demangle mangled name component.  */
>> +
>> +static struct demangle_component *
>> +d_make_demangle_mangled_name (struct d_info *di, const char *s, int len)
>> +{
>> +  if (d_peek_char (di) != '_' || d_peek_next_char (di) != 'Z')
>> +    return d_make_name (di, s, len);
>> +  d_advance (di, 2);
>> +  return d_encoding (di, 0);
>> +}
>
> Don't pass len to this function.  It should only take two parameters,
> di and s.  The functoin will only work correctly when called at the
> end of the name being demangled, so passing len is deceptive.  It
> should just call strlen (s) in the case where it calls d_make_name.
>
> This patch is OK with that change.
>

This patch updates testsuite/abi/demangle/regression/cw-13.cc.
OK for trunk?

Thanks.

Patch

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index def7148..faa1515 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@ 
+2010-11-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR other/42670
+	* testsuite/abi/demangle/regression/cw-13.cc: Updated.
+
 2010-11-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

 	PR libstdc++/45711
diff --git a/libstdc++-v3/testsuite/abi/demangle/regression/cw-13.cc b/libstdc++
-v3/testsuite/abi/demangle/regression/cw-13.cc
index c2e28bf..3ac3b13 100644
--- a/libstdc++-v3/testsuite/abi/demangle/regression/cw-13.cc
+++ b/libstdc++-v3/testsuite/abi/demangle/regression/cw-13.cc
@@ -27,7 +27,7 @@  int main()
   using namespace __gnu_test;

   // cplus-dem CORE
-  verify_demangle("_GLOBAL__I__Z2fnv", "global constructors keyed to _Z2fnv");
+  verify_demangle("_GLOBAL__I__Z2fnv", "global constructors keyed to fn()");

   return 0;
 }