* C++ PATCH for c++/77379 (abi_tag on thunk)
@ 2016-08-29 16:42 Jason Merrill
2016-08-29 20:11 ` [PATCH] Fix abi_tag23* test failure (PR c++/77379) Jakub Jelinek
2016-09-03 16:34 ` C++ PATCH for c++/77379 (abi_tag on thunk) Andreas Schwab
0 siblings, 2 replies; 5+ messages in thread
From: Jason Merrill @ 2016-08-29 16:42 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 79 bytes --]
Another missing ABI tag, sigh.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 77379.diff --]
[-- Type: text/plain, Size: 4791 bytes --]
commit 1337a943a2d3926537b63d6e1f0d7f46ef10a06d
Author: Jason Merrill <jason@redhat.com>
Date: Fri Aug 26 15:12:52 2016 -0400
PR c++/77379 - ABI tag on thunk
* mangle.c (maybe_check_abi_tags): Add version parm, handle thunks.
(mangle_thunk): Add thunk parameter.
* method.c (finish_thunk): Pass it.
* cp-tree.h: Declare it.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 72a128d..5bcb98b 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -6802,7 +6802,7 @@ extern tree mangle_typeinfo_string_for_type (tree);
extern tree mangle_vtbl_for_type (tree);
extern tree mangle_vtt_for_type (tree);
extern tree mangle_ctor_vtbl_for_type (tree, tree);
-extern tree mangle_thunk (tree, int, tree, tree);
+extern tree mangle_thunk (tree, int, tree, tree, tree);
extern tree mangle_conv_op_name_for_type (tree);
extern tree mangle_guard_variable (tree);
extern tree mangle_tls_init_fn (tree);
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index d8b5c45..d34743c 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -231,7 +231,7 @@ static void write_local_name (tree, const tree, const tree);
static void dump_substitution_candidates (void);
static tree mangle_decl_string (const tree);
static int local_class_index (tree);
-static void maybe_check_abi_tags (tree, tree = NULL_TREE);
+static void maybe_check_abi_tags (tree, tree = NULL_TREE, int = 10);
static bool equal_abi_tags (tree, tree);
/* Control functions. */
@@ -4024,10 +4024,13 @@ mangle_call_offset (const tree fixed_offset, const tree virtual_offset)
tree
mangle_thunk (tree fn_decl, const int this_adjusting, tree fixed_offset,
- tree virtual_offset)
+ tree virtual_offset, tree thunk)
{
tree result;
+ if (abi_version_at_least (11))
+ maybe_check_abi_tags (fn_decl, thunk, 11);
+
start_mangling (fn_decl);
write_string ("_Z");
@@ -4142,7 +4145,7 @@ mangle_conv_op_name_for_type (const tree type)
guard variable for T. */
static void
-maybe_check_abi_tags (tree t, tree for_decl)
+maybe_check_abi_tags (tree t, tree for_decl, int ver)
{
if (DECL_ASSEMBLER_NAME_SET_P (t))
return;
@@ -4153,9 +4156,14 @@ maybe_check_abi_tags (tree t, tree for_decl)
tree newtags = get_abi_tags (t);
if (newtags && newtags != oldtags
- && abi_version_crosses (10))
+ && abi_version_crosses (ver))
{
- if (for_decl)
+ if (for_decl && DECL_THUNK_P (for_decl))
+ warning_at (DECL_SOURCE_LOCATION (t), OPT_Wabi,
+ "the mangled name of a thunk for %qD changes between "
+ "-fabi-version=%d and -fabi-version=%d",
+ t, flag_abi_version, warn_abi_version);
+ else if (for_decl)
warning_at (DECL_SOURCE_LOCATION (for_decl), OPT_Wabi,
"the mangled name of %qD changes between "
"-fabi-version=%d and -fabi-version=%d",
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 75342ae..957ea39 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -169,7 +169,7 @@ finish_thunk (tree thunk)
virtual_offset = BINFO_VPTR_FIELD (virtual_offset);
function = THUNK_TARGET (thunk);
name = mangle_thunk (function, DECL_THIS_THUNK_P (thunk),
- fixed_offset, virtual_offset);
+ fixed_offset, virtual_offset, thunk);
/* We can end up with declarations of (logically) different
covariant thunks, that do identical adjustments. The two thunks
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag23.C b/gcc/testsuite/g++.dg/abi/abi-tag23.C
new file mode 100644
index 0000000..5e310a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag23.C
@@ -0,0 +1,35 @@
+// PR c++/77379
+// { dg-options "-fabi-version=0 -Wabi=10" }
+
+struct __attribute ((abi_tag ("bar"))) string { };
+
+struct Mother
+{
+ virtual ~Mother() {};
+ int bar;
+};
+
+struct Father
+{
+ virtual string get_foo() = 0;
+};
+
+class Derived:
+ public Mother,
+ public Father
+{
+public:
+ string get_foo(); // { dg-warning "mangled name" }
+};
+
+struct Final:
+ public Derived
+{
+};
+
+int main()
+{
+ Final().get_foo();
+}
+
+// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooB3barEv" } }
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag23a.C b/gcc/testsuite/g++.dg/abi/abi-tag23a.C
new file mode 100644
index 0000000..72aa037
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag23a.C
@@ -0,0 +1,35 @@
+// PR c++/77379
+// { dg-options -fabi-version=10 }
+
+struct __attribute ((abi_tag ("bar"))) string { };
+
+struct Mother
+{
+ virtual ~Mother() {};
+ int bar;
+};
+
+struct Father
+{
+ virtual string get_foo() = 0;
+};
+
+class Derived:
+ public Mother,
+ public Father
+{
+public:
+ string get_foo();
+};
+
+struct Final:
+ public Derived
+{
+};
+
+int main()
+{
+ Final().get_foo();
+}
+
+// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooEv" } }
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Fix abi_tag23* test failure (PR c++/77379)
2016-08-29 16:42 C++ PATCH for c++/77379 (abi_tag on thunk) Jason Merrill
@ 2016-08-29 20:11 ` Jakub Jelinek
2016-08-30 9:24 ` Christophe Lyon
2016-09-16 19:51 ` Jason Merrill
2016-09-03 16:34 ` C++ PATCH for c++/77379 (abi_tag on thunk) Andreas Schwab
1 sibling, 2 replies; 5+ messages in thread
From: Jakub Jelinek @ 2016-08-29 20:11 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches List
On Mon, Aug 29, 2016 at 12:42:28PM -0400, Jason Merrill wrote:
> Another missing ABI tag, sigh.
>
> Tested x86_64-pc-linux-gnu, applying to trunk.
> commit 1337a943a2d3926537b63d6e1f0d7f46ef10a06d
> Author: Jason Merrill <jason@redhat.com>
> Date: Fri Aug 26 15:12:52 2016 -0400
>
> PR c++/77379 - ABI tag on thunk
>
> * mangle.c (maybe_check_abi_tags): Add version parm, handle thunks.
> (mangle_thunk): Add thunk parameter.
> * method.c (finish_thunk): Pass it.
> * cp-tree.h: Declare it.
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/abi/abi-tag23.C
> +// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooB3barEv" } }
This unfortunately fails e.g. on i686-linux, because the symbol is
_ZThn8_N7Derived7get_fooB3barEv instead of
_ZThn16_N7Derived7get_fooB3barEv
The following patch accepts any negative offsets. Tested on x86_64-linux
and i686-linux, ok for trunk?
2016-08-29 Jakub Jelinek <jakub@redhat.com>
PR c++/77379
* g++.dg/abi/abi-tag23.C: Adjust scan-assembler regex for differing
thunk offsets.
* g++.dg/abi/abi-tag23a.C: Likewise.
--- gcc/g++.dg/abi/abi-tag23.C.jj 2016-08-29 19:34:12.000000000 +0200
+++ gcc/g++.dg/abi/abi-tag23.C 2016-08-29 22:04:16.328873328 +0200
@@ -32,4 +32,4 @@ int main()
Final().get_foo();
}
-// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooB3barEv" } }
+// { dg-final { scan-assembler "_ZThn\[0-9]+_N7Derived7get_fooB3barEv" } }
--- gcc/g++.dg/abi/abi-tag23a.C.jj 2016-08-29 19:34:12.000000000 +0200
+++ gcc/g++.dg/abi/abi-tag23a.C 2016-08-29 22:04:55.053398520 +0200
@@ -32,4 +32,4 @@ int main()
Final().get_foo();
}
-// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooEv" } }
+// { dg-final { scan-assembler "_ZThn\[0-9]+_N7Derived7get_fooEv" } }
Jakub
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix abi_tag23* test failure (PR c++/77379)
2016-08-29 20:11 ` [PATCH] Fix abi_tag23* test failure (PR c++/77379) Jakub Jelinek
@ 2016-08-30 9:24 ` Christophe Lyon
2016-09-16 19:51 ` Jason Merrill
1 sibling, 0 replies; 5+ messages in thread
From: Christophe Lyon @ 2016-08-30 9:24 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches List
On 29 August 2016 at 22:10, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Aug 29, 2016 at 12:42:28PM -0400, Jason Merrill wrote:
>> Another missing ABI tag, sigh.
>>
>> Tested x86_64-pc-linux-gnu, applying to trunk.
>
>> commit 1337a943a2d3926537b63d6e1f0d7f46ef10a06d
>> Author: Jason Merrill <jason@redhat.com>
>> Date: Fri Aug 26 15:12:52 2016 -0400
>>
>> PR c++/77379 - ABI tag on thunk
>>
>> * mangle.c (maybe_check_abi_tags): Add version parm, handle thunks.
>> (mangle_thunk): Add thunk parameter.
>> * method.c (finish_thunk): Pass it.
>> * cp-tree.h: Declare it.
>
>> --- /dev/null
>> +++ b/gcc/testsuite/g++.dg/abi/abi-tag23.C
>> +// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooB3barEv" } }
>
> This unfortunately fails e.g. on i686-linux, because the symbol is
It also fails on arm* targets.
> _ZThn8_N7Derived7get_fooB3barEv instead of
> _ZThn16_N7Derived7get_fooB3barEv
>
> The following patch accepts any negative offsets. Tested on x86_64-linux
> and i686-linux, ok for trunk?
>
> 2016-08-29 Jakub Jelinek <jakub@redhat.com>
>
> PR c++/77379
> * g++.dg/abi/abi-tag23.C: Adjust scan-assembler regex for differing
> thunk offsets.
> * g++.dg/abi/abi-tag23a.C: Likewise.
>
> --- gcc/g++.dg/abi/abi-tag23.C.jj 2016-08-29 19:34:12.000000000 +0200
> +++ gcc/g++.dg/abi/abi-tag23.C 2016-08-29 22:04:16.328873328 +0200
> @@ -32,4 +32,4 @@ int main()
> Final().get_foo();
> }
>
> -// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooB3barEv" } }
> +// { dg-final { scan-assembler "_ZThn\[0-9]+_N7Derived7get_fooB3barEv" } }
> --- gcc/g++.dg/abi/abi-tag23a.C.jj 2016-08-29 19:34:12.000000000 +0200
> +++ gcc/g++.dg/abi/abi-tag23a.C 2016-08-29 22:04:55.053398520 +0200
> @@ -32,4 +32,4 @@ int main()
> Final().get_foo();
> }
>
> -// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooEv" } }
> +// { dg-final { scan-assembler "_ZThn\[0-9]+_N7Derived7get_fooEv" } }
>
>
> Jakub
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: C++ PATCH for c++/77379 (abi_tag on thunk)
2016-08-29 16:42 C++ PATCH for c++/77379 (abi_tag on thunk) Jason Merrill
2016-08-29 20:11 ` [PATCH] Fix abi_tag23* test failure (PR c++/77379) Jakub Jelinek
@ 2016-09-03 16:34 ` Andreas Schwab
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2016-09-03 16:34 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches List
On Aug 29 2016, Jason Merrill <jason@redhat.com> wrote:
> +// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooEv" } }
>
FAIL: g++.dg/abi/abi-tag23.C -std=gnu++98 scan-assembler _ZThn16_N7Derived7get_fooB3barEv
$ grep _ZThn abi-tag23.s
.long _ZThn8_N7Derived7get_fooB3barEv
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix abi_tag23* test failure (PR c++/77379)
2016-08-29 20:11 ` [PATCH] Fix abi_tag23* test failure (PR c++/77379) Jakub Jelinek
2016-08-30 9:24 ` Christophe Lyon
@ 2016-09-16 19:51 ` Jason Merrill
1 sibling, 0 replies; 5+ messages in thread
From: Jason Merrill @ 2016-09-16 19:51 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches List
OK.
On Mon, Aug 29, 2016 at 4:10 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Aug 29, 2016 at 12:42:28PM -0400, Jason Merrill wrote:
>> Another missing ABI tag, sigh.
>>
>> Tested x86_64-pc-linux-gnu, applying to trunk.
>
>> commit 1337a943a2d3926537b63d6e1f0d7f46ef10a06d
>> Author: Jason Merrill <jason@redhat.com>
>> Date: Fri Aug 26 15:12:52 2016 -0400
>>
>> PR c++/77379 - ABI tag on thunk
>>
>> * mangle.c (maybe_check_abi_tags): Add version parm, handle thunks.
>> (mangle_thunk): Add thunk parameter.
>> * method.c (finish_thunk): Pass it.
>> * cp-tree.h: Declare it.
>
>> --- /dev/null
>> +++ b/gcc/testsuite/g++.dg/abi/abi-tag23.C
>> +// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooB3barEv" } }
>
> This unfortunately fails e.g. on i686-linux, because the symbol is
> _ZThn8_N7Derived7get_fooB3barEv instead of
> _ZThn16_N7Derived7get_fooB3barEv
>
> The following patch accepts any negative offsets. Tested on x86_64-linux
> and i686-linux, ok for trunk?
>
> 2016-08-29 Jakub Jelinek <jakub@redhat.com>
>
> PR c++/77379
> * g++.dg/abi/abi-tag23.C: Adjust scan-assembler regex for differing
> thunk offsets.
> * g++.dg/abi/abi-tag23a.C: Likewise.
>
> --- gcc/g++.dg/abi/abi-tag23.C.jj 2016-08-29 19:34:12.000000000 +0200
> +++ gcc/g++.dg/abi/abi-tag23.C 2016-08-29 22:04:16.328873328 +0200
> @@ -32,4 +32,4 @@ int main()
> Final().get_foo();
> }
>
> -// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooB3barEv" } }
> +// { dg-final { scan-assembler "_ZThn\[0-9]+_N7Derived7get_fooB3barEv" } }
> --- gcc/g++.dg/abi/abi-tag23a.C.jj 2016-08-29 19:34:12.000000000 +0200
> +++ gcc/g++.dg/abi/abi-tag23a.C 2016-08-29 22:04:55.053398520 +0200
> @@ -32,4 +32,4 @@ int main()
> Final().get_foo();
> }
>
> -// { dg-final { scan-assembler "_ZThn16_N7Derived7get_fooEv" } }
> +// { dg-final { scan-assembler "_ZThn\[0-9]+_N7Derived7get_fooEv" } }
>
>
> Jakub
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-09-16 19:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-29 16:42 C++ PATCH for c++/77379 (abi_tag on thunk) Jason Merrill
2016-08-29 20:11 ` [PATCH] Fix abi_tag23* test failure (PR c++/77379) Jakub Jelinek
2016-08-30 9:24 ` Christophe Lyon
2016-09-16 19:51 ` Jason Merrill
2016-09-03 16:34 ` C++ PATCH for c++/77379 (abi_tag on thunk) Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).