public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055
@ 2022-11-06 20:29 danakj at orodu dot net
2022-11-06 20:31 ` [Bug c++/107542] " pinskia at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: danakj at orodu dot net @ 2022-11-06 20:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
Bug ID: 107542
Summary: ICE in spaceship_comp_cat, at cp/method.cc:1055
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: danakj at orodu dot net
Target Milestone: ---
Repro: https://godbolt.org/z/KPfsn8hPf
Reproduces in 12.2 and trunk on Godbolt.org.
Output:
<source>: In substitution of 'template<class T, class U> requires Ord<const
T*, const U*> constexpr auto operator<=>(const S<T>&, const S<U>&) [with T =
int; U = char]':
<source>:6:11: required from here
<source>:6:11: internal compiler error: in spaceship_comp_cat, at
cp/method.cc:1055
6 | { lhs <=> rhs } -> std::same_as<std::strong_ordering>;
| ~~~~^~~~~~~
0x2393c6e internal_error(char const*, ...)
???:0
0xaa9b58 fancy_abort(char const*, int, char const*)
???:0
0xd4a507 cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
???:0
0xadb22c build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
???:0
0xd3b412 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
???:0
0xb25576 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0xb27052 constraints_satisfied_p(tree_node*, tree_node*)
???:0
0xcdd84a fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0xadaefe build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
???:0
0xd3b412 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
???:0
0xb25576 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0xb2715f evaluate_concept_check(tree_node*)
???:0
0xb18962 maybe_constant_value(tree_node*, tree_node*, bool)
???:0
0xcfdb3f finish_unary_op_expr(unsigned int, tree_code, cp_expr, int)
???:0
0xc872a7 c_parse_file()
???:0
0xdd0579 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
@ 2022-11-06 20:31 ` pinskia at gcc dot gnu.org
2022-11-06 20:38 ` danakj at orodu dot net
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-06 20:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 53840
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53840&action=edit
testcase
Note please next time also attach the testcase (or put it inline) and not just
link against godbolt.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
2022-11-06 20:31 ` [Bug c++/107542] " pinskia at gcc dot gnu.org
@ 2022-11-06 20:38 ` danakj at orodu dot net
2022-11-06 20:39 ` danakj at orodu dot net
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: danakj at orodu dot net @ 2022-11-06 20:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
--- Comment #2 from danakj at orodu dot net ---
The same thing works okay with operator== instead of operator<=>
https://godbolt.org/z/qnPx3bYT4
```
#include <compare>
#include <concepts>
template <class Lhs, class Rhs>
concept Ord = requires(const Lhs& lhs, const Rhs& rhs) {
{ lhs <=> rhs } -> std::same_as<std::strong_ordering>;
};
template <class Lhs, class Rhs>
concept Eq = requires(const Lhs& lhs, const Rhs& rhs) {
{ lhs == rhs } -> std::same_as<bool>;
};
template <class T>
struct S {
T* p;
};
template <class T, class U>
requires(Eq<const T*, const U*>)
bool operator==(const S<T>& l, const S<U>& r) {
return l.p == r.p;
}
template <class T, class U>
requires(Ord<const T*, const U*>)
constexpr inline auto operator<=>(const S<T>& l, const S<U>& r) noexcept {
return l.p <=> r.p;
}
static_assert(Ord<S<int>, S<int>>); // Works.
// static_assert(!Ord<S<int>, S<S<int>>>); // ICE.
static_assert(Eq<S<int>, S<int>>); // Works.
static_assert(!Eq<S<int>, S<char>>); // Works.
```
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
2022-11-06 20:31 ` [Bug c++/107542] " pinskia at gcc dot gnu.org
2022-11-06 20:38 ` danakj at orodu dot net
@ 2022-11-06 20:39 ` danakj at orodu dot net
2022-11-21 13:00 ` marxin at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: danakj at orodu dot net @ 2022-11-06 20:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
--- Comment #3 from danakj at orodu dot net ---
> Note please next time also attach the testcase (or put it inline) and not just link against godbolt.
Will do, thanks for attaching it for me.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
` (2 preceding siblings ...)
2022-11-06 20:39 ` danakj at orodu dot net
@ 2022-11-21 13:00 ` marxin at gcc dot gnu.org
2022-11-29 19:25 ` ppalka at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-11-21 13:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-11-21
Ever confirmed|0 |1
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:
$ cat pr107542.ii
template <class Lhs, class Rhs>
concept Ord = requires(Lhs lhs, Rhs rhs) { lhs <=> rhs; };
template <class> struct S;
template <class T, class U>
requires(Ord<T *, U *>)
auto operator<=>(T, U) {
!Ord<int, S<int>>;
}
Note spaceship_comp_cat is called with:
optype=<error_mark 0x7ffff7621fa8>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
` (3 preceding siblings ...)
2022-11-21 13:00 ` marxin at gcc dot gnu.org
@ 2022-11-29 19:25 ` ppalka at gcc dot gnu.org
2022-11-30 0:25 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-11-29 19:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
` (4 preceding siblings ...)
2022-11-29 19:25 ` ppalka at gcc dot gnu.org
@ 2022-11-30 0:25 ` cvs-commit at gcc dot gnu.org
2022-11-30 0:27 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-30 0:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:000e9863120cbc75a0f8d497264519974c97669f
commit r13-4397-g000e9863120cbc75a0f8d497264519974c97669f
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Nov 29 19:25:37 2022 -0500
c++: ICE with <=> of incompatible pointers [PR107542]
In a SFINAE context composite_pointer_type returns error_mark_node if
the given pointer types are incompatible. But the SPACESHIP_EXPR case
of cp_build_binary_op wasn't prepared for this error_mark_node result,
which led to an ICE (from spaceship_comp_cat) for the below testcase.
(In a non-SFINAE context composite_pointer_type issues a permerror and
returns cv void* in this case, so this ICE seems specific to SFINAE.)
PR c++/107542
gcc/cp/ChangeLog:
* typeck.cc (cp_build_binary_op): In the SPACESHIP_EXPR case,
handle an error_mark_node result type.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/spaceship-sfinae2.C: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
` (5 preceding siblings ...)
2022-11-30 0:25 ` cvs-commit at gcc dot gnu.org
@ 2022-11-30 0:27 ` ppalka at gcc dot gnu.org
2022-12-19 16:54 ` cvs-commit at gcc dot gnu.org
2022-12-19 16:55 ` ppalka at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-11-30 0:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.3
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
` (6 preceding siblings ...)
2022-11-30 0:27 ` ppalka at gcc dot gnu.org
@ 2022-12-19 16:54 ` cvs-commit at gcc dot gnu.org
2022-12-19 16:55 ` ppalka at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-19 16:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:37595f8354e3e48e4a1a94537f3d1ae095ed75df
commit r12-8994-g37595f8354e3e48e4a1a94537f3d1ae095ed75df
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Nov 29 19:25:37 2022 -0500
c++: ICE with <=> of incompatible pointers [PR107542]
In a SFINAE context composite_pointer_type returns error_mark_node if
the given pointer types are incompatible. But the SPACESHIP_EXPR case
of cp_build_binary_op wasn't prepared for this error_mark_node result,
which led to an ICE (from spaceship_comp_cat) for the below testcase.
(In a non-SFINAE context composite_pointer_type issues a permerror and
returns cv void* in this case, so this ICE seems specific to SFINAE.)
PR c++/107542
gcc/cp/ChangeLog:
* typeck.cc (cp_build_binary_op): In the SPACESHIP_EXPR case,
handle an error_mark_node result type.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/spaceship-sfinae2.C: New test.
(cherry picked from commit 000e9863120cbc75a0f8d497264519974c97669f)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/107542] ICE in spaceship_comp_cat, at cp/method.cc:1055
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
` (7 preceding siblings ...)
2022-12-19 16:54 ` cvs-commit at gcc dot gnu.org
@ 2022-12-19 16:55 ` ppalka at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-19 16:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107542
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12.3/13, thanks for the bug report.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-12-19 16:55 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-06 20:29 [Bug c++/107542] New: ICE in spaceship_comp_cat, at cp/method.cc:1055 danakj at orodu dot net
2022-11-06 20:31 ` [Bug c++/107542] " pinskia at gcc dot gnu.org
2022-11-06 20:38 ` danakj at orodu dot net
2022-11-06 20:39 ` danakj at orodu dot net
2022-11-21 13:00 ` marxin at gcc dot gnu.org
2022-11-29 19:25 ` ppalka at gcc dot gnu.org
2022-11-30 0:25 ` cvs-commit at gcc dot gnu.org
2022-11-30 0:27 ` ppalka at gcc dot gnu.org
2022-12-19 16:54 ` cvs-commit at gcc dot gnu.org
2022-12-19 16:55 ` ppalka 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).