diff options
author | trippels <trippels@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-18 08:40:05 +0000 |
---|---|---|
committer | trippels <trippels@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-18 08:40:05 +0000 |
commit | a2929a3a9a9ad7dea28a2c76f0124a9fa5e58238 (patch) | |
tree | 1b2783df9fcda5852973bca7fca843bd8a07e970 /libiberty | |
parent | 24c12d4958812efd827fe499c24efbb9ee1aaebe (diff) | |
download | gcc-a2929a3a9a9ad7dea28a2c76f0124a9fa5e58238.tar.gz |
Fix PR77489 -- mangling of discriminator >= 1
libiberty:
PR c++/77489
* cp-demangle.c (d_discriminator): Handle discriminator >= 10.
* testsuite/demangle-expected: Add tests for discriminator.
gcc:
PR c++/77489
* doc/invoke.texi (fabi-version): Document discriminator mangling.
gcc/cp:
PR c++/77489
* mangle.c (write_discriminator): Handle discriminator >= 10.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244566 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 6 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 22 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 16 |
3 files changed, 42 insertions, 2 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 20dee7e821d..104907c84c8 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,9 @@ +2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de> + + PR c++/77489 + * cp-demangle.c (d_discriminator): Handle discriminator >= 10. + * testsuite/demangle-expected: Add tests for discriminator. + 2017-01-04 Jakub Jelinek <jakub@redhat.com> Update copyright years. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 15ef3b48785..d84929eca20 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3609,7 +3609,11 @@ d_local_name (struct d_info *di) } } -/* <discriminator> ::= _ <(non-negative) number> +/* <discriminator> ::= _ <number> # when number < 10 + ::= __ <number> _ # when number >= 10 + + <discriminator> ::= _ <number> # when number >=10 + is also accepted to support gcc versions that wrongly mangled that way. We demangle the discriminator, but we don't print it out. FIXME: We should print it out in verbose mode. */ @@ -3617,14 +3621,28 @@ d_local_name (struct d_info *di) static int d_discriminator (struct d_info *di) { - int discrim; + int discrim, num_underscores = 1; if (d_peek_char (di) != '_') return 1; d_advance (di, 1); + if (d_peek_char (di) == '_') + { + ++num_underscores; + d_advance (di, 1); + } + discrim = d_number (di); if (discrim < 0) return 0; + if (num_underscores > 1 && discrim >= 10) + { + if (d_peek_char (di) == '_') + d_advance (di, 1); + else + return 0; + } + return 1; } diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index b65dcd3450e..07e258fe58b 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4666,3 +4666,19 @@ void eat<int*, Foo()::{lambda(auto:1*, auto:2*)#6}>(int*&, Foo()::{lambda(auto:1 _Z3eatIPiZ3BarIsEvvEUlPsPT_PT0_E0_EvRS3_RS5_ void eat<int*, void Bar<short>()::{lambda(short*, auto:1*, auto:2*)#2}>(int*&, void Bar<short>()::{lambda(short*, auto:1*, auto:2*)#2}&) + +# PR 77489 +_ZZ3foovE8localVar_9 +foo()::localVar + +_ZZ3foovE8localVar_10 +foo()::localVar + +_ZZ3foovE8localVar__10_ +foo()::localVar + +_ZZ3foovE8localVar__9_ +_ZZ3foovE8localVar__9_ + +_ZZ3foovE8localVar__12 +_ZZ3foovE8localVar__12 |