diff options
author | palves <palves@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-28 21:55:41 +0000 |
---|---|---|
committer | palves <palves@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-05-28 21:55:41 +0000 |
commit | 61b1440327acebe3aebb7bca187df4abafbf3179 (patch) | |
tree | e19defa1e850831a55ee81c911579554676c74c7 /libiberty | |
parent | 7f9463ecb4e1285d80975224aff4d71e7a64bc2e (diff) | |
download | gcc-61b1440327acebe3aebb7bca187df4abafbf3179.tar.gz |
Fix demangler testsuite crashes with CP_DEMANGLE_DEBUG defined
Running the demangler's testsuite with CP_DEMANGLE_DEBUG defined
crashes, with:
Program received signal SIGSEGV, Segmentation fault.
0x000000000040a8c3 in d_dump (dc=0x1, indent=12) at ../../src/libiberty/cp-demangle.c:567
567 switch (dc->type)
(gdb) bt 3
#0 0x000000000040a8c3 in d_dump (dc=0x1, indent=12) at ../../src/libiberty/cp-demangle.c:567
#1 0x000000000040ae47 in d_dump (dc=0x7fffffffd098, indent=10) at ../../src/libiberty/cp-demangle.c:787
#2 0x000000000040ae47 in d_dump (dc=0x7fffffffd0c8, indent=8) at ../../src/libiberty/cp-demangle.c:787
Note dc=0x1, which is obviously a bogus pointer. This is the end of
d_dump recursing for a component type that that doesn't actually have
subtrees:
787 d_dump (d_left (dc), indent + 2);
788 d_dump (d_right (dc), indent + 2);
This fixes the two cases the testsuite currently trips on.
libiberty/
2014-05-28 Pedro Alves <palves@redhat.com>
* cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_FUNCTION_PARAM
and DEMANGLE_COMPONENT_NUMBER.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211035 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 5 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 7b25c7e9f5c..16eb6f75ef4 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,8 @@ +2014-05-28 Pedro Alves <palves@redhat.com> + + * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_FUNCTION_PARAM + and DEMANGLE_COMPONENT_NUMBER. + 2014-05-22 Thomas Schwinge <thomas@codesourcery.com> * testsuite/demangle-expected: Fix last commit. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 68d8ee16c93..c0d2ffee7d9 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -575,6 +575,9 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_TEMPLATE_PARAM: printf ("template parameter %ld\n", dc->u.s_number.number); return; + case DEMANGLE_COMPONENT_FUNCTION_PARAM: + printf ("function parameter %ld\n", dc->u.s_number.number); + return; case DEMANGLE_COMPONENT_CTOR: printf ("constructor %d\n", (int) dc->u.s_ctor.kind); d_dump (dc->u.s_ctor.name, indent + 2); @@ -760,6 +763,9 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_CHARACTER: printf ("character '%c'\n", dc->u.s_character.character); return; + case DEMANGLE_COMPONENT_NUMBER: + printf ("number %ld\n", dc->u.s_number.number); + return; case DEMANGLE_COMPONENT_DECLTYPE: printf ("decltype\n"); break; |