diff mbox

Patch: fix demangler crash

Message ID m339ume55t.fsf@fleche.redhat.com
State New
Headers show

Commit Message

Tom Tromey Aug. 10, 2010, 5:41 p.m. UTC
This patch comes from

    http://sourceware.org/bugzilla/show_bug.cgi?id=11572

The demangler crashes on a certain input; I verified this on the compile
farm.

With this patch, the demangler does not crash.  I also ran test-demangle
under valgrind and didn't see any reports.

I am not 100% certain that the new output is correct.  I would
appreciate it if somebody knowledgeable about lambdas could look at
this.

Ok to commit?

Tom

2010-08-10  James Lyon  <jameslyon0@googlemail.com>

	http://sourceware.org/bugzilla/show_bug.cgi?id=11572
	* cp-demangle.c (d_find_pack): Add case for
	DEMANGLE_COMPONENT_LAMBDA.
	* testsuite/demangle-expected: Add regression test.

Comments

Tom Tromey Aug. 24, 2010, 5:54 p.m. UTC | #1
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> This patch comes from
Tom>     http://sourceware.org/bugzilla/show_bug.cgi?id=11572
Tom> The demangler crashes on a certain input; I verified this on the compile
Tom> farm.

Ping.

Tom
Tom Tromey Sept. 1, 2010, 10:43 p.m. UTC | #2
Tom> This patch comes from
Tom> http://sourceware.org/bugzilla/show_bug.cgi?id=11572
Tom> The demangler crashes on a certain input; I verified this on the compile
Tom> farm.

Tom> Ping.

Ping again.

Tom
Richard Biener Sept. 2, 2010, 8:56 a.m. UTC | #3
On Thu, Sep 2, 2010 at 12:43 AM, Tom Tromey <tromey@redhat.com> wrote:
> Tom> This patch comes from
> Tom> http://sourceware.org/bugzilla/show_bug.cgi?id=11572
> Tom> The demangler crashes on a certain input; I verified this on the compile
> Tom> farm.
>
> Tom> Ping.
>
> Ping again.

I'd say the patch counts as obvious.

Richard.

> Tom
>
Diego Novillo Sept. 2, 2010, 1:24 p.m. UTC | #4
On Thu, Sep 2, 2010 at 04:56, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Thu, Sep 2, 2010 at 12:43 AM, Tom Tromey <tromey@redhat.com> wrote:
>> Tom> This patch comes from
>> Tom> http://sourceware.org/bugzilla/show_bug.cgi?id=11572
>> Tom> The demangler crashes on a certain input; I verified this on the compile
>> Tom> farm.
>>
>> Tom> Ping.
>>
>> Ping again.
>
> I'd say the patch counts as obvious.

Indeed.


Diego.
diff mbox

Patch

diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index d2d15e9..39c8cc0 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -3480,6 +3480,7 @@  d_find_pack (struct d_print_info *dpi,
     case DEMANGLE_COMPONENT_PACK_EXPANSION:
       return NULL;
       
+    case DEMANGLE_COMPONENT_LAMBDA:
     case DEMANGLE_COMPONENT_NAME:
     case DEMANGLE_COMPONENT_OPERATOR:
     case DEMANGLE_COMPONENT_BUILTIN_TYPE:
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 15a0fe7..0085564 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -4052,3 +4052,8 @@  prot.lock.update
 --format=gnu-v3
 DFA
 DFA
+#
+# http://sourceware.org/bugzilla/show_bug.cgi?id=11572
+--format=auto
+_ZN3Psi7VariantIIcPKcEE5visitIIRZN11VariantTest9TestVisit11test_methodEvEUlS2_E0_RZNS6_11test_methodEvEUlcE1_RZNS6_11test_methodEvEUlNS_4NoneEE_EEENS_13VariantDetail19SelectVisitorResultIIDpT_EE4typeEDpOSG_
+Psi::VariantDetail::SelectVisitorResult<VariantTest::TestVisit::test_method()::{lambda(char const*)#2}&, VariantTest::TestVisit::test_method()::{lambda(char)#3}&, VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&>::type Psi::Variant<char, char const*>::visit<VariantTest::TestVisit::test_method()::{lambda(char const*)#2}&, VariantTest::TestVisit::test_method()::{lambda(char)#3}&, VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&>((VariantTest::TestVisit::test_method()::{lambda(Psi::None)#1}&&&)...)