* [Bug c++/107864] Internal Compiler Error (Large Project, C++20)
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
@ 2022-11-24 19:38 ` pinskia at gcc dot gnu.org
2022-11-24 21:40 ` pinskia at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 19:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
/path/to/mycodedistr/include/mycode/grfx/_cpu/../color/../../_stdafx/_math.hpp:111:23:
internal compiler error: Segmentation fault
0x120e72f crash_signal
/home/apinski/src/upstream-gcc/gcc/gcc/toplev.cc:314
0xc5c9b2 check_return_expr(tree_node*, bool*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/typeck.cc:11062
0xc07eee finish_return_stmt(tree_node*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/semantics.cc:1229
0xbca0db tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:18580
0xbc9931 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:18932
0xbd4295 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:18556
0xbd4295 instantiate_body
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:26484
0xbd52ba instantiate_decl(tree_node*, bool, bool)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:26774
0xbf2b2b instantiate_pending_templates(int)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:26852
0xaaa7fb c_parse_final_cleanups()
/home/apinski/src/upstream-gcc/gcc/gcc/cp/decl2.cc:4940
0xcd38b0 c_common_parse_file()
/home/apinski/src/upstream-gcc/gcc/gcc/c-family/c-opts.cc:1266
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.
Let me try to reduce it.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] Internal Compiler Error (Large Project, C++20)
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
2022-11-24 19:38 ` [Bug c++/107864] " pinskia at gcc dot gnu.org
@ 2022-11-24 21:40 ` pinskia at gcc dot gnu.org
2022-11-24 21:42 ` pinskia at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 21:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, I don't know if I reduced it too much but this might be __bfloat16_t
related ...
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] Internal Compiler Error (Large Project, C++20)
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
2022-11-24 19:38 ` [Bug c++/107864] " pinskia at gcc dot gnu.org
2022-11-24 21:40 ` pinskia at gcc dot gnu.org
@ 2022-11-24 21:42 ` pinskia at gcc dot gnu.org
2022-11-24 21:48 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 21:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Hmm, I don't know if I reduced it too much but this might be __bfloat16_t
> related ...
It is not, I changed 0.0bf16 to just 0.0f and it fails. still reducing it.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] Internal Compiler Error (Large Project, C++20)
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (2 preceding siblings ...)
2022-11-24 21:42 ` pinskia at gcc dot gnu.org
@ 2022-11-24 21:48 ` pinskia at gcc dot gnu.org
2022-11-24 21:51 ` [Bug c++/107864] [10/11/12/13 Regression] ICE (seg fault) in check_return_expr with concepts and specialized version pinskia at gcc dot gnu.org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 21:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2022-11-24
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
template<class T>
T j( T const& val ) requires true
{
return val;
}
template<> int j( int const& val ) { return 0; }
int t = j(1);
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] [10/11/12/13 Regression] ICE (seg fault) in check_return_expr with concepts and specialized version
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (3 preceding siblings ...)
2022-11-24 21:48 ` pinskia at gcc dot gnu.org
@ 2022-11-24 21:51 ` pinskia at gcc dot gnu.org
2022-11-24 21:55 ` [Bug c++/107864] [10/11/12/13 Regression] ICE (seg fault) in check_return_expr or instantiate_body " pinskia at gcc dot gnu.org
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 21:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.1.0, 11.1.0
Known to work| |9.5.0
Target Milestone|--- |10.5
Summary|ICE (seg fault) in |[10/11/12/13 Regression]
|check_return_expr with |ICE (seg fault) in
|concepts and specialized |check_return_expr with
|version |concepts and specialized
| |version
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Works in GCC 9.5.0 with -std=c++2a -fconcepts.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] [10/11/12/13 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (4 preceding siblings ...)
2022-11-24 21:51 ` [Bug c++/107864] [10/11/12/13 Regression] ICE (seg fault) in check_return_expr with concepts and specialized version pinskia at gcc dot gnu.org
@ 2022-11-24 21:55 ` pinskia at gcc dot gnu.org
2022-11-25 0:11 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-24 21:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12/13 Regression] |[10/11/12/13 Regression]
|ICE (seg fault) in |ICE (seg fault) in
|check_return_expr with |check_return_expr or
|concepts and specialized |instantiate_body with
|version |concepts and specialized
| |version
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note without the concept there, GCC does not ICE.
Note changing it slightly (remove the if return type):
template<class T>
void j( T const& val ) requires true {}
template<> void j( int const& val ) { }
void g() {
j(1);
}
--- CUT ---
Gives a different ICE:
t.cc: In instantiation of ‘void j(const T&) requires true [with T = int]’:
t.cc:5:4: required from here
t.cc:2:39: internal compiler error: Segmentation fault
2 | void j( T const& val ) requires true {}
| ^
0x120e72f crash_signal
/home/apinski/src/upstream-gcc/gcc/gcc/toplev.cc:314
0xbd42d1 instantiate_body
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:26494
0xbd52ba instantiate_decl(tree_node*, bool, bool)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:26774
0xbf2b2b instantiate_pending_templates(int)
/home/apinski/src/upstream-gcc/gcc/gcc/cp/pt.cc:26852
0xaaa7fb c_parse_final_cleanups()
/home/apinski/src/upstream-gcc/gcc/gcc/cp/decl2.cc:4940
0xcd38b0 c_common_parse_file()
/home/apinski/src/upstream-gcc/gcc/gcc/c-family/c-opts.cc:1266
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] 14+ messages in thread
* [Bug c++/107864] [10/11/12/13 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (5 preceding siblings ...)
2022-11-24 21:55 ` [Bug c++/107864] [10/11/12/13 Regression] ICE (seg fault) in check_return_expr or instantiate_body " pinskia at gcc dot gnu.org
@ 2022-11-25 0:11 ` redi at gcc dot gnu.org
2022-11-28 16:23 ` ppalka at gcc dot gnu.org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-25 0:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Regression started with r10-3735-gcb57504a550158 "Update the concepts
implementation to conform to C++20."
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] [10/11/12/13 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (6 preceding siblings ...)
2022-11-25 0:11 ` redi at gcc dot gnu.org
@ 2022-11-28 16:23 ` ppalka at gcc dot gnu.org
2022-11-29 14:55 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-11-28 16:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
CC| |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] [10/11/12/13 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (7 preceding siblings ...)
2022-11-28 16:23 ` ppalka at gcc dot gnu.org
@ 2022-11-29 14:55 ` cvs-commit at gcc dot gnu.org
2022-11-29 15:06 ` [Bug c++/107864] [10/11/12 " ppalka at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-29 14:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
--- Comment #8 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:36cabc257dfb7dd4f7625896891f6c5b195a0241
commit r13-4390-g36cabc257dfb7dd4f7625896891f6c5b195a0241
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Nov 29 09:55:21 2022 -0500
c++: explicit specialization and trailing requirements [PR107864]
Here we're crashing when using the explicit specialization of the
function template g with trailing requirements ultimately because
earlier decls_match (called indirectly from register_specialization) for
for the explicit specialization returned false since the template has
trailing requirements whereas the specialization doesn't.
In r12-2230-gddd25bd1a7c8f4, we fixed a similar issue concerning template
requirements instead of trailing requirements. We could extend that fix
to ignore trailing requirement mismatches for explicit specializations
as well, but it seems cleaner to just propagate constraints from the
specialized template to the specialization when declaring an explicit
specialization so that decls_match will naturally return true in this
case. And it looks like determine_specialization already does this,
albeit inconsistently (only when specializing a non-template member
function of a class template as in cpp2a/concepts-explicit-spec4.C).
So this patch makes determine_specialization consistently propagate
constraints from the specialized template to the specialization, which
in turn lets us get rid of the function_requirements_equivalent_p special
case added by r12-2230.
PR c++/107864
gcc/cp/ChangeLog:
* decl.cc (function_requirements_equivalent_p): Don't check
DECL_TEMPLATE_SPECIALIZATION.
* pt.cc (determine_specialization): Propagate constraints when
specializing a function template too. Simplify by using
add_outermost_template_args.
gcc/testsuite/ChangeLog:
* g++.dg/concepts/explicit-spec1a.C: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] [10/11/12 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (8 preceding siblings ...)
2022-11-29 14:55 ` cvs-commit at gcc dot gnu.org
@ 2022-11-29 15:06 ` ppalka at gcc dot gnu.org
2023-03-07 2:18 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-11-29 15:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11/12/13 Regression] |[10/11/12 Regression] ICE
|ICE (seg fault) in |(seg fault) in
|check_return_expr or |check_return_expr or
|instantiate_body with |instantiate_body with
|concepts and specialized |concepts and specialized
|version |version
--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] [10/11/12 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (9 preceding siblings ...)
2022-11-29 15:06 ` [Bug c++/107864] [10/11/12 " ppalka at gcc dot gnu.org
@ 2023-03-07 2:18 ` cvs-commit at gcc dot gnu.org
2023-05-22 3:12 ` [Bug c++/107864] [10/11 " cvs-commit at gcc dot gnu.org
2023-07-07 10:04 ` [Bug c++/107864] [10 " rguenth at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-07 2:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
--- Comment #10 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:18bd59990196462cde8011458e2518118b1b6681
commit r12-9228-g18bd59990196462cde8011458e2518118b1b6681
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Nov 29 09:55:21 2022 -0500
c++: explicit specialization and trailing requirements [PR107864]
Here we're crashing when using the explicit specialization of the
function template g with trailing requirements ultimately because
earlier decls_match (called indirectly from register_specialization) for
for the explicit specialization returned false since the template has
trailing requirements whereas the specialization doesn't.
In r12-2230-gddd25bd1a7c8f4, we fixed a similar issue concerning template
requirements instead of trailing requirements. We could extend that fix
to ignore trailing requirement mismatches for explicit specializations
as well, but it seems cleaner to just propagate constraints from the
specialized template to the specialization when declaring an explicit
specialization so that decls_match will naturally return true in this
case. And it looks like determine_specialization already does this,
albeit inconsistently (only when specializing a non-template member
function of a class template as in cpp2a/concepts-explicit-spec4.C).
So this patch makes determine_specialization consistently propagate
constraints from the specialized template to the specialization, which
in turn lets us get rid of the function_requirements_equivalent_p special
case added by r12-2230.
PR c++/107864
gcc/cp/ChangeLog:
* decl.cc (function_requirements_equivalent_p): Don't check
DECL_TEMPLATE_SPECIALIZATION.
* pt.cc (determine_specialization): Propagate constraints when
specializing a function template too. Simplify by using
add_outermost_template_args.
gcc/testsuite/ChangeLog:
* g++.dg/concepts/explicit-spec1a.C: New test.
(cherry picked from commit 36cabc257dfb7dd4f7625896891f6c5b195a0241)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] [10/11 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (10 preceding siblings ...)
2023-03-07 2:18 ` cvs-commit at gcc dot gnu.org
@ 2023-05-22 3:12 ` cvs-commit at gcc dot gnu.org
2023-07-07 10:04 ` [Bug c++/107864] [10 " rguenth at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-22 3:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:17e3edd6a25e47eed56678f25f6f8ab29b0ac5fc
commit r11-10803-g17e3edd6a25e47eed56678f25f6f8ab29b0ac5fc
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Nov 29 09:55:21 2022 -0500
c++: explicit specialization and trailing requirements [PR107864]
Here we're crashing when using the explicit specialization of the
function template g with trailing requirements ultimately because
earlier decls_match (called indirectly from register_specialization) for
for the explicit specialization returned false since the template has
trailing requirements whereas the specialization doesn't.
In r12-2230-gddd25bd1a7c8f4, we fixed a similar issue concerning template
requirements instead of trailing requirements. We could extend that fix
to ignore trailing requirement mismatches for explicit specializations
as well, but it seems cleaner to just propagate constraints from the
specialized template to the specialization when declaring an explicit
specialization so that decls_match will naturally return true in this
case. And it looks like determine_specialization already does this,
albeit inconsistently (only when specializing a non-template member
function of a class template as in cpp2a/concepts-explicit-spec4.C).
So this patch makes determine_specialization consistently propagate
constraints from the specialized template to the specialization, which
in turn lets us get rid of the function_requirements_equivalent_p special
case added by r12-2230.
PR c++/107864
gcc/cp/ChangeLog:
* decl.c (function_requirements_equivalent_p): Don't check
DECL_TEMPLATE_SPECIALIZATION.
* pt.c (determine_specialization): Propagate constraints when
specializing a function template too. Simplify by using
add_outermost_template_args.
gcc/testsuite/ChangeLog:
* g++.dg/concepts/explicit-spec1a.C: New test.
(cherry picked from commit 36cabc257dfb7dd4f7625896891f6c5b195a0241)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/107864] [10 Regression] ICE (seg fault) in check_return_expr or instantiate_body with concepts and specialized version
2022-11-24 19:17 [Bug c++/107864] New: Internal Compiler Error (Large Project, C++20) ian at geometrian dot com
` (11 preceding siblings ...)
2023-05-22 3:12 ` [Bug c++/107864] [10/11 " cvs-commit at gcc dot gnu.org
@ 2023-07-07 10:04 ` rguenth at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107864
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|10.5 |11.4
Status|ASSIGNED |RESOLVED
Known to work| |11.4.0, 12.3.0, 13.1.0
Known to fail| |10.5.0, 11.3.0
--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 14+ messages in thread