+2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
+
+ PR c++/77489
+ * doc/invoke.texi (fabi-version): Document discriminator mangling.
+
2017-01-17 Segher Boessenkool <segher@kernel.crashing.org>
PR target/78875
+2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de>
+
+ PR c++/77489
+ * mangle.c (write_discriminator): Handle discriminator >= 10.
+
2017-01-17 Nathan Sidwell <nathan@acm.org>
PR c++/61636
return 0;
}
-/* <discriminator> := _ <number>
+/* <discriminator> := _ <number> # when number < 10
+ := __ <number> _ # when number >= 10
The discriminator is used only for the second and later occurrences
of the same name within a single function. In this case <number> is
if (discriminator > 0)
{
write_char ('_');
+ if (abi_version_at_least (11) && discriminator - 1 >= 10)
+ {
+ write_char ('_');
+ if (abi_warn_or_compat_version_crosses (11))
+ G.need_abi_warning = 1;
+ }
write_unsigned_number (discriminator - 1);
+ if (abi_version_at_least (11) && discriminator - 1 >= 10)
+ write_char ('_');
}
}
attributes (e.g. @samp{stdcall}).
Version 11, which first appeared in G++ 7, corrects the mangling of
-sizeof... expressions. It also implies
+sizeof... expressions. For multiple entities with the same name within
+a function, that are declared in different scopes, the mangling now
+changes starting with the eighth occurence. It also implies
@option{-fnew-inheriting-ctors}.
See also @option{-Wabi}.
--- /dev/null
+// { dg-options -fabi-version=11 }
+
+extern void bar(int*);
+
+void foo()
+{
+ {
+ static int localVar = 0;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 1;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 2;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 3;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 4;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 5;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 6;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 7;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 8;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 9;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 10;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 11;
+ bar(&localVar);
+ }
+ {
+ static int localVar = 12;
+ bar(&localVar);
+ }
+}
+
+// { dg-final { scan-assembler "_ZZ3foovE8localVar_9" } }
+// { dg-final { scan-assembler "_ZZ3foovE8localVar__10_" } }
+// { dg-final { scan-assembler "_ZZ3foovE8localVar__11_" } }
+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.
}
}
-/* <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. */
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;
}
_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