public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103937] New: Assembler error: symbol is already defined when compiling static member function templates
@ 2022-01-07 8:44 mac.zyg2 at protonmail dot com
2022-01-07 8:44 ` [Bug c++/103937] " mac.zyg2 at protonmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mac.zyg2 at protonmail dot com @ 2022-01-07 8:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103937
Bug ID: 103937
Summary: Assembler error: symbol is already defined when
compiling static member function templates
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mac.zyg2 at protonmail dot com
Target Milestone: ---
Created attachment 52139
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52139&action=edit
Full error message for GCC 11.2
This code doesn't compile with "symbol ... is already defined":
```
class SortAlgorithm {
public:
template<typename T>
static void test(T* t, bool(*compare_func)() =
[]() -> bool { return true; }) {
test(t);
}
};
int main() {
int arr[] { 1, 2 };
SortAlgorithm::test(arr);
}
```
The names that are included in the error demangles to this:
```
>>> demangle('_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_clEv')
'SortAlgorithm::test<int>(int*, bool (*)())::{default
arg#1}::{lambda()#1}::operator()() const'
>>> demangle('_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NUlvE_4_FUNEv')
'SortAlgorithm::test<int>(int*, bool (*)())::{default
arg#1}::{lambda()#1}::_FUN()'
>>> demangle('_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_cvS4_Ev')
'SortAlgorithm::test<int>(int*, bool (*)())::{default
arg#1}::{lambda()#1}::operator bool (*)()() const'
```
This code throws internal compiler error on trunk:
```
<source>:13:1: error: Two symbols with same comdat_group are not linked by the
same_comdat_group list.
13 | }
| ^
_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_cvS4_Ev/6 (constexpr
SortAlgorithm::<lambda()>::operator bool (*)()() const) @0x7f86cadb8880
Type: function definition analyzed
Visibility: semantic_interposition no_reorder public weak comdat
comdat_group:_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_cvS4_Ev one_only
artificial
previous sharing asm name: 2
References: _ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NUlvE_4_FUNEv/5 (addr)
__gxx_personality_v0/8 (addr)
Referring:
Function flags: body
Called by: _ZN13SortAlgorithm4testIiEEvPT_PFbvE/7
Calls:
_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_cvS4_Ev/2 (constexpr
SortAlgorithm::<lambda()>::operator bool (*)()() const) @0x7f86cadb8440
Type: function definition analyzed
Visibility: semantic_interposition no_reorder public weak comdat
comdat_group:_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_cvS4_Ev one_only
artificial
next sharing asm name: 6
References: _ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NUlvE_4_FUNEv/1 (addr)
__gxx_personality_v0/8 (addr)
Referring:
Function flags: body
Called by: main/3
Calls:
<source>:13:1: internal compiler error: symtab_node::verify failed
0x213d2c9 internal_error(char const*, ...)
???:0
0xbd4532 symtab_node::verify_symtab_nodes()
???:0
0xbf0a6f symbol_table::finalize_compilation_unit()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```
Demo: https://godbolt.org/z/G796Wxehb
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/103937] Assembler error: symbol is already defined when compiling static member function templates
2022-01-07 8:44 [Bug c++/103937] New: Assembler error: symbol is already defined when compiling static member function templates mac.zyg2 at protonmail dot com
@ 2022-01-07 8:44 ` mac.zyg2 at protonmail dot com
2022-01-07 8:47 ` [Bug c++/103937] [11/12 Regression] Assembler error: symbol is already defined when compiling static member function templates since r11-7965-g23be03a0f243a084 marxin at gcc dot gnu.org
2022-01-07 8:49 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mac.zyg2 at protonmail dot com @ 2022-01-07 8:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103937
--- Comment #1 from mac.zyg2 at protonmail dot com ---
Created attachment 52140
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52140&action=edit
Generated assembly on GCC 11.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/103937] [11/12 Regression] Assembler error: symbol is already defined when compiling static member function templates since r11-7965-g23be03a0f243a084
2022-01-07 8:44 [Bug c++/103937] New: Assembler error: symbol is already defined when compiling static member function templates mac.zyg2 at protonmail dot com
2022-01-07 8:44 ` [Bug c++/103937] " mac.zyg2 at protonmail dot com
@ 2022-01-07 8:47 ` marxin at gcc dot gnu.org
2022-01-07 8:49 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-07 8:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103937
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-01-07
Keywords| |ice-on-valid-code
Summary|Assembler error: symbol is |[11/12 Regression]
|already defined when |Assembler error: symbol is
|compiling static member |already defined when
|function templates |compiling static member
| |function templates since
| |r11-7965-g23be03a0f243a084
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Target Milestone|--- |11.3
Ever confirmed|0 |1
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r11-7965-g23be03a0f243a084:
pr103937.C:13:1: error: Two symbols with same comdat_group are not linked by
the same_comdat_group list.
13 | }
| ^
_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_cvS4_Ev/6 (constexpr
SortAlgorithm::<lambda()>::operator bool (*)()() const) @0x7ffff7933770
Type: function definition analyzed
Visibility: no_reorder public weak comdat
comdat_group:_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_cvS4_Ev one_only
artificial
previous sharing asm name: 2
References: _ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NUlvE_4_FUNEv/5 (addr)
__gxx_personality_v0/8 (addr)
Referring:
Function flags: body
Called by: _ZN13SortAlgorithm4testIiEEvPT_PFbvE/7
Calls:
_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_cvS4_Ev/2 (constexpr
SortAlgorithm::<lambda()>::operator bool (*)()() const) @0x7ffff7933330
Type: function definition analyzed
Visibility: no_reorder public weak comdat
comdat_group:_ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NKUlvE_cvS4_Ev one_only
artificial
next sharing asm name: 6
References: _ZZN13SortAlgorithm4testIiEEvPT_PFbvEEd_NUlvE_4_FUNEv/1 (addr)
__gxx_personality_v0/8 (addr)
Referring:
Function flags: body
Called by: main/3
Calls:
pr103937.C:13:1: internal compiler error: symtab_node::verify failed
0x7ffff7a545bf __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7ffff7a5467b __libc_start_main_impl
../csu/libc-start.c:409
Please submit a full bug report,
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/103937] [11/12 Regression] Assembler error: symbol is already defined when compiling static member function templates since r11-7965-g23be03a0f243a084
2022-01-07 8:44 [Bug c++/103937] New: Assembler error: symbol is already defined when compiling static member function templates mac.zyg2 at protonmail dot com
2022-01-07 8:44 ` [Bug c++/103937] " mac.zyg2 at protonmail dot com
2022-01-07 8:47 ` [Bug c++/103937] [11/12 Regression] Assembler error: symbol is already defined when compiling static member function templates since r11-7965-g23be03a0f243a084 marxin at gcc dot gnu.org
@ 2022-01-07 8:49 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 8:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103937
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 103186.
*** This bug has been marked as a duplicate of bug 103186 ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-07 8:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 8:44 [Bug c++/103937] New: Assembler error: symbol is already defined when compiling static member function templates mac.zyg2 at protonmail dot com
2022-01-07 8:44 ` [Bug c++/103937] " mac.zyg2 at protonmail dot com
2022-01-07 8:47 ` [Bug c++/103937] [11/12 Regression] Assembler error: symbol is already defined when compiling static member function templates since r11-7965-g23be03a0f243a084 marxin at gcc dot gnu.org
2022-01-07 8:49 ` pinskia at gcc dot gnu.org
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).