summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-26 14:28:23 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-26 14:28:23 +0000
commit84be2b4d0a55c95697c9ecc72bb31c2fbd316127 (patch)
tree9f86d2c5b414f5b66cf20d81c2c01016b551f038 /libiberty
parentdb3e66dcbb8e2564f23b42855df640272c0d54af (diff)
downloadgcc-84be2b4d0a55c95697c9ecc72bb31c2fbd316127.tar.gz
* cp-demangle.c (d_print_init): Initialize pack_index field.
(d_print_comp): Check for NULL template argument. * testsuite/demangle-expected: Add test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176791 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog6
-rw-r--r--libiberty/cp-demangle.c10
-rw-r--r--libiberty/testsuite/demangle-expected6
3 files changed, 21 insertions, 1 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 97c50c0ea7d..1ceb0ee2787 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-26 Ian Lance Taylor <iant@google.com>
+
+ * cp-demangle.c (d_print_init): Initialize pack_index field.
+ (d_print_comp): Check for NULL template argument.
+ * testsuite/demangle-expected: Add test case.
+
2011-07-22 Gerald Pfeifer <gerald@pfeifer.com>
PR target/49817
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 29badbba187..f41856be6d0 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -1,5 +1,5 @@
/* Demangler for g++ V3 ABI.
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@wasabisystems.com>.
@@ -3306,6 +3306,7 @@ d_print_init (struct d_print_info *dpi, demangle_callbackref callback,
dpi->last_char = '\0';
dpi->templates = NULL;
dpi->modifiers = NULL;
+ dpi->pack_index = 0;
dpi->flush_count = 0;
dpi->callback = callback;
@@ -3893,6 +3894,13 @@ d_print_comp (struct d_print_info *dpi, int options,
struct demangle_component *a = d_lookup_template_argument (dpi, sub);
if (a && a->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST)
a = d_index_template_argument (a, dpi->pack_index);
+
+ if (a == NULL)
+ {
+ d_print_error (dpi);
+ return;
+ }
+
sub = a;
}
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 2dc74beb9e2..d3e709924dc 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -4010,6 +4010,12 @@ K<1, &S::m>::f()
_ZN1KILi1EXadL_ZN1S1mEEEE1fEv
K<1, &S::m>::f()
#
+# Used to crash -- binutils PR 13030.
+--format=gnu-v3
+_ZSt10_ConstructI10CellBorderIS0_EEvPT_DpOT0_
+_ZSt10_ConstructI10CellBorderIS0_EEvPT_DpOT0_
+_ZSt10_ConstructI10CellBorderIS0_EEvPT_DpOT0_
+#
# Ada (GNAT) tests.
#
# Simple test.