public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99429] New: ICE for bool return from <=>
@ 2021-03-06 14:51 msharov at users dot sourceforge.net
2021-03-06 14:53 ` [Bug c++/99429] " msharov at users dot sourceforge.net
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: msharov at users dot sourceforge.net @ 2021-03-06 14:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99429
Bug ID: 99429
Summary: ICE for bool return from <=>
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msharov at users dot sourceforge.net
Target Milestone: ---
Created attachment 50315
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50315&action=edit
std::strong_ordering and incorrect duration code
When erronously declaring <=> to return bool, g++ crashes:
> g++ -c -std=c++20 chrono.cc
chrono.cc: In instantiation of ‘class duration<1>’:
chrono.cc:44:42: required from here
chrono.cc:38:20: internal compiler error: Segmentation fault
38 | constexpr bool operator<=> (const duration& d) const = default;
| ^~~~~~~~
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/99429] ICE for bool return from <=>
2021-03-06 14:51 [Bug c++/99429] New: ICE for bool return from <=> msharov at users dot sourceforge.net
@ 2021-03-06 14:53 ` msharov at users dot sourceforge.net
2021-03-06 17:49 ` [Bug c++/99429] [10/11 Regression] " jakub at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: msharov at users dot sourceforge.net @ 2021-03-06 14:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99429
Mike Sharov <msharov at users dot sourceforge.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #50315|0 |1
is obsolete| |
--- Comment #1 from Mike Sharov <msharov at users dot sourceforge.net> ---
Created attachment 50316
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50316&action=edit
incorrect duration
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/99429] [10/11 Regression] ICE for bool return from <=>
2021-03-06 14:51 [Bug c++/99429] New: ICE for bool return from <=> msharov at users dot sourceforge.net
2021-03-06 14:53 ` [Bug c++/99429] " msharov at users dot sourceforge.net
@ 2021-03-06 17:49 ` jakub at gcc dot gnu.org
2021-03-06 18:03 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-06 17:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99429
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.3
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Summary|ICE for bool return from |[10/11 Regression] ICE for
|<=> |bool return from <=>
Priority|P3 |P2
CC| |jakub at gcc dot gnu.org
Last reconfirmed| |2021-03-06
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started to ICE with r10-4397-gb7689b962dd6536bbb2567bfdec52e35109af7ab
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/99429] [10/11 Regression] ICE for bool return from <=>
2021-03-06 14:51 [Bug c++/99429] New: ICE for bool return from <=> msharov at users dot sourceforge.net
2021-03-06 14:53 ` [Bug c++/99429] " msharov at users dot sourceforge.net
2021-03-06 17:49 ` [Bug c++/99429] [10/11 Regression] " jakub at gcc dot gnu.org
@ 2021-03-06 18:03 ` jakub at gcc dot gnu.org
2021-03-07 16:16 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-06 18:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99429
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly reduced:
namespace std {
struct strong_ordering {
int _v;
constexpr strong_ordering (int v) :_v(v) {}
constexpr operator int (void) const { return _v; }
static const strong_ordering less;
static const strong_ordering equal;
static const strong_ordering greater;
};
constexpr strong_ordering strong_ordering::less = -1;
constexpr strong_ordering strong_ordering::equal = 0;
constexpr strong_ordering strong_ordering::greater = 1;
}
template <unsigned long N>
struct duration {
static constexpr const long period = N;
constexpr duration (void) = default;
constexpr duration (const duration& d) = default;
constexpr bool operator== (const duration& d) const = default;
constexpr bool operator<=> (const duration& d) const = default;
long _d;
};
using nanoseconds = duration<1>;
using microseconds = duration<nanoseconds::period * 1000>;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/99429] [10/11 Regression] ICE for bool return from <=>
2021-03-06 14:51 [Bug c++/99429] New: ICE for bool return from <=> msharov at users dot sourceforge.net
` (2 preceding siblings ...)
2021-03-06 18:03 ` jakub at gcc dot gnu.org
@ 2021-03-07 16:16 ` redi at gcc dot gnu.org
2021-03-08 16:31 ` jakub at gcc dot gnu.org
2021-08-12 7:34 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-03-07 16:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99429
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Dup of PR 94162 ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/99429] [10/11 Regression] ICE for bool return from <=>
2021-03-06 14:51 [Bug c++/99429] New: ICE for bool return from <=> msharov at users dot sourceforge.net
` (3 preceding siblings ...)
2021-03-07 16:16 ` redi at gcc dot gnu.org
@ 2021-03-08 16:31 ` jakub at gcc dot gnu.org
2021-08-12 7:34 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-03-08 16:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99429
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yes.
*** This bug has been marked as a duplicate of bug 94162 ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/99429] [10/11 Regression] ICE for bool return from <=>
2021-03-06 14:51 [Bug c++/99429] New: ICE for bool return from <=> msharov at users dot sourceforge.net
` (4 preceding siblings ...)
2021-03-08 16:31 ` jakub at gcc dot gnu.org
@ 2021-08-12 7:34 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-12 7:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99429
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:9b7ab853bf33106fd0539e36d6ce7730269026e1
commit r12-2873-g9b7ab853bf33106fd0539e36d6ce7730269026e1
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Aug 12 09:16:13 2021 +0200
c++: Fix ICE on defaulted spaceship with pointer return type [PR94162]
The spaceship-synth-neg6.C testcase ICEs because we call cat_tag_for
on the explicit return type, but pointer types don't have
TYPE_LINKAGE_IDENTIFIER. The patch fixes that by checking for
CLASS_TYPE_P only and also adds verification that it is in std
namespace, so we don't return non-cc_last for
my_namespace::partial_ordering.
The g++.dg/cpp2a/spaceship-synth11.C testcase is from a PR that has been
fixed with r12-619-gfc178519771db508c03611cff4a1466cf67fce1d (but
not backported to 11).
2021-08-12 Jakub Jelinek <jakub@redhat.com>
gcc/cp/
PR c++/94162
* method.c (cat_tag_for): Return cc_last for !CLASS_TYPE_P
or for classes not in std namespace.
gcc/testsuite/
PR c++/99429
* g++.dg/cpp2a/spaceship-synth11.C: New test.
PR c++/94162
* g++.dg/cpp2a/spaceship-synth-neg6.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-08-12 7:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-06 14:51 [Bug c++/99429] New: ICE for bool return from <=> msharov at users dot sourceforge.net
2021-03-06 14:53 ` [Bug c++/99429] " msharov at users dot sourceforge.net
2021-03-06 17:49 ` [Bug c++/99429] [10/11 Regression] " jakub at gcc dot gnu.org
2021-03-06 18:03 ` jakub at gcc dot gnu.org
2021-03-07 16:16 ` redi at gcc dot gnu.org
2021-03-08 16:31 ` jakub at gcc dot gnu.org
2021-08-12 7:34 ` cvs-commit 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).