* cplus-dem.c (demangle_template): Register a new Btype only
authorJoel Brobecker <brobecker@gnat.com>
Mon, 20 Oct 2003 23:50:37 +0000 (23:50 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Mon, 20 Oct 2003 23:50:37 +0000 (23:50 +0000)
when needed.
* testsuite/demangle-expected: Add a new test.

libiberty/ChangeLog
libiberty/cplus-dem.c
libiberty/testsuite/demangle-expected

index 04aa508408dfb5028dde8c2d0b638fe26c70746d..6264fbf5a0b9e82a7a1dbcb5654c62d2847aac57 100644 (file)
@@ -1,3 +1,9 @@
+2003-10-20  J. Brobecker  <brobecker@gnat.com>
+
+       * cplus-dem.c (demangle_template): Register a new Btype only
+       when needed.
+       * testsuite/demangle-expected: Add a new test.
+
 2003-10-16  H.J. Lu  <hongjiu.lu@intel.com>
 
        * testsuite/demangle-expected: Update the expected output of
index 59afcd371ba5f4caa5240a1e286235e29d737d1a..5e2e7a7126c1321190b959164ebf8f07cf3b3d50 100644 (file)
@@ -2043,13 +2043,10 @@ demangle_template (work, mangled, tname, trawname, is_type, remember)
   const char *start;
   int is_java_array = 0;
   string temp;
-  int bindex = 0;
 
   (*mangled)++;
   if (is_type)
     {
-      if (remember)
-       bindex = register_Btype (work);
       start = *mangled;
       /* get template name */
       if (**mangled == 'z')
@@ -2226,7 +2223,10 @@ demangle_template (work, mangled, tname, trawname, is_type, remember)
     }
 
   if (is_type && remember)
-    remember_Btype (work, tname->b, LEN_STRING (tname), bindex);
+    {
+      const int bindex = register_Btype (work);
+      remember_Btype (work, tname->b, LEN_STRING (tname), bindex);
+    }
 
   /*
     if (work -> static_type)
index dabcc1953c20bb528d9c41ddb2ca6fdb54ac6982..d57066651b14da8c7c32d0d12a3cbd6020b06d76 100644 (file)
@@ -2864,3 +2864,9 @@ r(int (G::*)(), int (G::*)() const, G, int (H::*)(), int (G::*)(), what<G const>
 --format=auto
 __CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator
 __CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator
+#
+# This used to cause a crash. It doesn't follow the C++ syntax so
+# the demangled name should be identical to the original symbol name.
+--format=auto
+_test_array__L_1__B23b___clean.6
+_test_array__L_1__B23b___clean.6