Blob Blame History Raw
2004-06-28  Ian Lance Taylor  <ian@wasabisystems.com>

	PR other/16240
	* cp-demangle.c (d_expr_primary): Check for a failure return from
	cplus_demangle_type.
	* testsuite/demangle-expected: Add test case.

--- libiberty/cp-demangle.c	25 Feb 2004 04:51:37 -0000	1.73
+++ libiberty/cp-demangle.c	28 Jun 2004 15:23:33 -0000	1.74
@@ -2398,6 +2398,8 @@ d_expr_primary (di)
       const char *s;
 
       type = cplus_demangle_type (di);
+      if (type == NULL)
+	return NULL;
 
       /* If we have a type we know how to print, we aren't going to
 	 print the type name itself.  */
--- libiberty/testsuite/demangle-expected	25 Feb 2004 04:51:39 -0000	1.30
+++ libiberty/testsuite/demangle-expected	28 Jun 2004 17:36:27 -0000	1.31
@@ -3699,6 +3699,11 @@ _Z3fooIPA3_iEvRKT_
 void foo<int (*) [3]>(int (* const&) [3])
 foo<int (*) [3]>
 #
+# This used to crash the demangler--PR 16240
+--format=gnu-v3 --no-params
+_ZN13PatternDriver23StringScalarDeleteValueC1ERKNS_25ConflateStringScalarValueERKNS_25AbstractStringScalarValueERKNS_12TemplateEnumINS_12pdcomplementELZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE
+_ZN13PatternDriver23StringScalarDeleteValueC1ERKNS_25ConflateStringScalarValueERKNS_25AbstractStringScalarValueERKNS_12TemplateEnumINS_12pdcomplementELZNS_16complement_namesEELZNS_14COMPLEMENTENUMEEEE
+PatternDriver::StringScalarDeleteValue::StringScalarDeleteValue
 # Test GNU V3 constructor and destructor identification.
 # 0 means it is not a constructor/destructor.
 # Other integers correspond to enum gnu_v3_{c,d}tor_kinds in demangle.h.