[Bug c++/98481] [10/11 Regression] std::vector::size_type as return type gets tagged with abi:cxx11

2021-01-11 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98481

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jason Merrill :

https://gcc.gnu.org/g:3dd0d3ee1d2a988e7f3a3e8f009fcf328f16d2ed

commit r11-6592-g3dd0d3ee1d2a988e7f3a3e8f009fcf328f16d2ed
Author: Jakub Jelinek 
Date:   Thu Jan 7 17:47:18 2021 +0100

c++, abi: Fix abi_tag attribute handling [PR98481]

In GCC10 cp_walk_subtrees has been changed to walk template arguments.
As the following testcase, that changed the mangling of some functions.
I believe the previous behavior that find_abi_tags_r doesn't recurse into
template args has been the correct one, but setting *walk_subtrees = 0
for the types and handling the types subtree walking manually in
find_abi_tags_r looks too hard, there are a lot of subtrees and details
what
should and shouldn't be walked, both in tree.c (walk_type_fields there,
which is static) and in cp_walk_subtrees itself.

The following patch abuses the fact that *walk_subtrees is an int to
tell cp_walk_subtrees it shouldn't walk the template args.

Co-authored-by: Jason Merrill 

gcc/cp/ChangeLog:

PR c++/98481
* class.c (find_abi_tags_r): Set *walk_subtrees to 2 instead of 1
for types.
(mark_abi_tags_r): Likewise.
* decl2.c (min_vis_r): Likewise.
* tree.c (cp_walk_subtrees): If *walk_subtrees_p is 2, look through
typedefs.

gcc/testsuite/ChangeLog:

PR c++/98481
* g++.dg/abi/abi-tag24.C: New test.

[Bug c++/98481] [10/11 Regression] std::vector::size_type as return type gets tagged with abi:cxx11

2021-01-07 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98481

--- Comment #4 from Jakub Jelinek  ---
Created attachment 49910
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49910=edit
gcc11-pr98481.patch

Untested fix.

[Bug c++/98481] [10/11 Regression] std::vector::size_type as return type gets tagged with abi:cxx11

2021-01-07 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98481

--- Comment #3 from Jakub Jelinek  ---
So, likely during
1598  cp_walk_tree_without_duplicates (, find_abi_tags_r, );
we should avoid walking into the template parameters.
I guess either it can be done by setting *walk_subtrees in find_abi_tags_r for
TYPE_P and handling it manually without the walking into template args, but
we'd need to repeat what walk_type_fields and cp_walk_subtrees does on types,
or perhaps some global variable that will temporarily disable walking into the
template parameters, or perhaps abuse the fact that *walk_subtrees is int
rather than bool and for TYPE_P set *walk_subtrees to 2 rather than 1 if
non-zero and treat that in cp_walk_subtrees as a request not to walk template
parameters.

[Bug c++/98481] [10/11 Regression] std::vector::size_type as return type gets tagged with abi:cxx11

2021-01-07 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98481

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/98481] [10/11 Regression] std::vector::size_type as return type gets tagged with abi:cxx11

2021-01-07 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98481

--- Comment #2 from Jakub Jelinek  ---
Started with r10-6517-g1e042b396e2a84e3ee17bc52def1bf241cb7d248

[Bug c++/98481] [10/11 Regression] std::vector::size_type as return type gets tagged with abi:cxx11

2021-01-07 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98481

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 CC||jakub at gcc dot gnu.org
   Last reconfirmed||2021-01-07
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek  ---
This boils down to:
inline namespace N __attribute ((__abi_tag__ ("cxx11")))
{
  struct A {};
}
template 
struct B { typedef int size_type; };
struct S1 { B::size_type foo () const { return 1; } };
struct S2 { B::size_type foo () const; };
int S2::foo () const { return 2; }

int
main ()
{
  auto f1 = ::foo;
  auto f2 = ::foo;
}

[Bug c++/98481] [10/11 Regression] std::vector::size_type as return type gets tagged with abi:cxx11

2021-01-05 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98481

Richard Biener  changed:

   What|Removed |Added

   Keywords||ABI
 CC||jason at gcc dot gnu.org
Summary|std::vector::s |[10/11 Regression]
   |ize_type as return type |std::vector::s
   |gets tagged with abi:cxx11  |ize_type as return type
   ||gets tagged with abi:cxx11
   Target Milestone|--- |10.3