public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107282] New: ICE on valid code template + overloaded + visit
@ 2022-10-16 23:07 boris_oncev at hotmail dot com
2022-10-17 11:51 ` [Bug c++/107282] " marxin at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: boris_oncev at hotmail dot com @ 2022-10-16 23:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107282
Bug ID: 107282
Summary: ICE on valid code template + overloaded + visit
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: boris_oncev at hotmail dot com
Target Milestone: ---
ICE on >=C++17 on all supported versions
https://godbolt.org/z/5exMcrhYz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107282] ICE on valid code template + overloaded + visit
2022-10-16 23:07 [Bug c++/107282] New: ICE on valid code template + overloaded + visit boris_oncev at hotmail dot com
@ 2022-10-17 11:51 ` marxin at gcc dot gnu.org
2022-10-17 12:08 ` marxin at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-17 11:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107282
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Thanks for the report, please always paste source code here and not to an
external service:
#include <variant>
template <class... Ts>
struct overloaded : Ts... {
using Ts::operator()...;
};
template <class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;
using Var1 = std::variant<int, float>;
struct Unrelated {
Var1 bar;
};
// works without the template
template <class T>
Var1 copyLifeState(Var1 const& value) {
return std::visit(overloaded{
[](auto&) -> Var1 { return {1}; },
[](Unrelated& v) -> Var1 {
return std::visit(
overloaded{
[](int) -> Var1 { return {2}; },
[](float) -> Var1 { return {2}; },
},
v.bar);
},
},
value);
}
int main() {
Var1 value = 2;
copyLifeState<int>(value);
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107282] ICE on valid code template + overloaded + visit
2022-10-16 23:07 [Bug c++/107282] New: ICE on valid code template + overloaded + visit boris_oncev at hotmail dot com
2022-10-17 11:51 ` [Bug c++/107282] " marxin at gcc dot gnu.org
@ 2022-10-17 12:08 ` marxin at gcc dot gnu.org
2022-10-18 13:31 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-17 12:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107282
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-10-17
CC| |nathan at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:
$ cat pr107282.ii
template <typename _Visitor, typename _Variants>
void visit(_Visitor, _Variants);
template <class... Ts> struct overloaded : Ts... {
using Ts::operator()...;
};
template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
template <class> int copyLifeState(int value) {
visit(overloaded{[] { overloaded{[] {}}; }}, value);
return 0;
}
int
main() { int value = copyLifeState<int>(value); }
Maybe started with r11-6855-g4804de453e7f5f90.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107282] ICE on valid code template + overloaded + visit
2022-10-16 23:07 [Bug c++/107282] New: ICE on valid code template + overloaded + visit boris_oncev at hotmail dot com
2022-10-17 11:51 ` [Bug c++/107282] " marxin at gcc dot gnu.org
2022-10-17 12:08 ` marxin at gcc dot gnu.org
@ 2022-10-18 13:31 ` ppalka at gcc dot gnu.org
2022-10-18 16:55 ` marxin at gcc dot gnu.org
2022-10-19 11:38 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-10-18 13:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107282
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Hmm, that commit seems unrelated. Bisection for me points to
r11-2455-gc6ef9d8d3f1122 (with -g).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107282] ICE on valid code template + overloaded + visit
2022-10-16 23:07 [Bug c++/107282] New: ICE on valid code template + overloaded + visit boris_oncev at hotmail dot com
` (2 preceding siblings ...)
2022-10-18 13:31 ` ppalka at gcc dot gnu.org
@ 2022-10-18 16:55 ` marxin at gcc dot gnu.org
2022-10-19 11:38 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-10-18 16:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107282
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Yes, sorry, I can verify it started with r11-2455-gc6ef9d8d3f11221d.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/107282] ICE on valid code template + overloaded + visit
2022-10-16 23:07 [Bug c++/107282] New: ICE on valid code template + overloaded + visit boris_oncev at hotmail dot com
` (3 preceding siblings ...)
2022-10-18 16:55 ` marxin at gcc dot gnu.org
@ 2022-10-19 11:38 ` rguenth at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-19 11:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107282
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
So we are late processing (rest_of_handle_final) dwaf2out_decl of copyLifeState
and there iterating the scope vars which include a TYPE_DECL ._anon_2 here
for which we generate a type DIE because
27023 if (is_redundant_typedef (decl))
27024 gen_type_die (TREE_TYPE (decl), context_die);
but the type was already generated early and there will be no way to
refer to just the type late (or TYPE_DECLs in practice from LTO).
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index e81044b8c48..090465a4896 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -27021,7 +27021,10 @@ gen_decl_die (tree decl, tree origin, struct
vlr_context *ctx,
break;
if (is_redundant_typedef (decl))
- gen_type_die (TREE_TYPE (decl), context_die);
+ {
+ if (early_dwarf)
+ gen_type_die (TREE_TYPE (decl), context_die);
+ }
else
/* Output a DIE to represent the typedef itself. */
gen_typedef_die (decl, context_die);
fixes this, but I'm not sure it isn't barking up the wrong tree given
the bisection - but that should only end up emitting more debug early
and not affect what we do late.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-10-19 11:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-16 23:07 [Bug c++/107282] New: ICE on valid code template + overloaded + visit boris_oncev at hotmail dot com
2022-10-17 11:51 ` [Bug c++/107282] " marxin at gcc dot gnu.org
2022-10-17 12:08 ` marxin at gcc dot gnu.org
2022-10-18 13:31 ` ppalka at gcc dot gnu.org
2022-10-18 16:55 ` marxin at gcc dot gnu.org
2022-10-19 11:38 ` rguenth 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).