public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
@ 2023-07-02 14:51 slyfox at gcc dot gnu.org
2023-07-02 14:54 ` [Bug c++/110523] " slyfox at gcc dot gnu.org
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-07-02 14:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
Bug ID: 110523
Summary: [14 Regression] ICE in redeclare_class_template, at
cp/pt.cc:6391 on json-3.11.2
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: slyfox at gcc dot gnu.org
Target Milestone: ---
Noticed ICE on r14-2233-gfca6d9c12f5bf0 when was building json-3.11.2 package.
Extracted reproducer:
// $ cat bug.cpp
template <typename, typename> struct adl_serializer;
template <template <typename, typename> class = adl_serializer>
class basic_json;
template <typename> struct json_pointer {
template <template <typename, typename> class> friend class basic_json;
};
template <template <typename, typename> class> struct basic_json {
using json_pointer = json_pointer<int>;
};
basic_json<>::json_pointer __trans_tmp_1_DOCTEST_ANON_FUNC_2() {
json_pointer<basic_json<>> ptr_j;
}
$ g++ -c bug.cpp
bug.cpp:10:9: warning: declaration of 'using basic_json<
<template-parameter-1-1> >::json_pointer = struct json_pointer<int>' changes
meaning of 'json_pointer' [-Wchanges-meaning]
10 | using json_pointer = json_pointer<int>;
| ^~~~~~~~~~~~
bug.cpp:10:24: note: used here to mean 'struct json_pointer<int>'
10 | using json_pointer = json_pointer<int>;
| ^~~~~~~~~~~~~~~~~
bug.cpp:6:28: note: declared here
6 | template <typename> struct json_pointer {
| ^~~~~~~~~~~~
bug.cpp: In instantiation of 'struct json_pointer<basic_json<> >':
bug.cpp:13:30: required from here
bug.cpp:7:63: internal compiler error: in redeclare_class_template, at
cp/pt.cc:6391
7 | template <template <typename, typename> class> friend class
basic_json;
|
^~~~~~~~~~
0x708b6c redeclare_class_template(tree_node*, tree_node*, tree_node*)
../../source/gcc/cp/pt.cc:6391
0x8fe749 tsubst_friend_class
../../source/gcc/cp/pt.cc:11590
0x8fe749 instantiate_class_template(tree_node*)
../../source/gcc/cp/pt.cc:12446
0x9398ed complete_type(tree_node*)
../../source/gcc/cp/typeck.cc:138
0x7c49e2 start_decl_1(tree_node*, bool)
../../source/gcc/cp/decl.cc:5980
0x7de3e9 start_decl_1(tree_node*, bool)
../../source/gcc/cp/decl.cc:5946
0x7de3e9 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../source/gcc/cp/decl.cc:5946
0x8b70b7 cp_parser_init_declarator
../../source/gcc/cp/parser.cc:22951
0x88f971 cp_parser_simple_declaration
../../source/gcc/cp/parser.cc:15435
0x891520 cp_parser_declaration_statement
../../source/gcc/cp/parser.cc:14516
0x891c39 cp_parser_statement
../../source/gcc/cp/parser.cc:12574
0x892d6d cp_parser_statement_seq_opt
../../source/gcc/cp/parser.cc:13000
0x892e0f cp_parser_compound_statement
../../source/gcc/cp/parser.cc:12952
0x8b5881 cp_parser_function_body
../../source/gcc/cp/parser.cc:25372
0x8b5881 cp_parser_ctor_initializer_opt_and_function_body
../../source/gcc/cp/parser.cc:25423
0x8b6a4e cp_parser_function_definition_after_declarator
../../source/gcc/cp/parser.cc:32058
0x8b7dcc cp_parser_function_definition_from_specifiers_and_declarator
../../source/gcc/cp/parser.cc:31975
0x8b7dcc cp_parser_init_declarator
../../source/gcc/cp/parser.cc:22831
0x88f971 cp_parser_simple_declaration
../../source/gcc/cp/parser.cc:15435
0x8c1ddb cp_parser_declaration
../../source/gcc/cp/parser.cc:15121
$ g++ -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-14.0.0/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-14.0.0/libexec/gcc/x86_64-unknown-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 99999999 (experimental) (GCC)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
@ 2023-07-02 14:54 ` slyfox at gcc dot gnu.org
2023-07-02 17:00 ` pinskia at gcc dot gnu.org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-07-02 14:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
--- Comment #1 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Created attachment 55452
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55452&action=edit
bug.cpp.orig.xz
In case I reduced the file incorrectly attaching bug.cpp.orig.xz which should
build with both gcc-13 and gcc-14.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
2023-07-02 14:54 ` [Bug c++/110523] " slyfox at gcc dot gnu.org
@ 2023-07-02 17:00 ` pinskia at gcc dot gnu.org
2023-07-02 17:07 ` pinskia at gcc dot gnu.org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-02 17:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
Keywords| |ice-on-valid-code
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
2023-07-02 14:54 ` [Bug c++/110523] " slyfox at gcc dot gnu.org
2023-07-02 17:00 ` pinskia at gcc dot gnu.org
@ 2023-07-02 17:07 ` pinskia at gcc dot gnu.org
2023-07-02 19:10 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-02 17:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Re-reducing it so it is warning free as the original was warning free.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (2 preceding siblings ...)
2023-07-02 17:07 ` pinskia at gcc dot gnu.org
@ 2023-07-02 19:10 ` pinskia at gcc dot gnu.org
2023-07-04 10:15 ` dcb314 at hotmail dot com
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-02 19:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-07-02
Ever confirmed|0 |1
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Better reduced testcase:
```
template <typename> class v {};
template <template <typename> class a = v>
class basic_json {};
template <typename t>
struct json_pointer {
template <template <typename> class a>
friend class basic_json;
using type = t;
};
json_pointer<int>::type t;
json_pointer<basic_json<>>::type t1;
```
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (3 preceding siblings ...)
2023-07-02 19:10 ` pinskia at gcc dot gnu.org
@ 2023-07-04 10:15 ` dcb314 at hotmail dot com
2023-07-04 10:36 ` dcb314 at hotmail dot com
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-07-04 10:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
David Binderman <dcb314 at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dcb314 at hotmail dot com
--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---
I see something similar when building dlib:
/home/dcb38/rpmbuild/BUILD/dlib-65bce59a1512cf222dec01d3e0f29b612dd181f5/dlib/../dlib/dnn/core.h:799:22:
internal compiler error: in redeclare_class_template, at cp/pt.cc:6391
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (4 preceding siblings ...)
2023-07-04 10:15 ` dcb314 at hotmail dot com
@ 2023-07-04 10:36 ` dcb314 at hotmail dot com
2023-07-04 11:12 ` dcb314 at hotmail dot com
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-07-04 10:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
The compiler seems to break as follows:
/home/dcb38/gcc/results.20230701/bin/gcc
/home/dcb38/gcc/results.20230703.asan.ubsan/bin/gcc
/home/dcb38/rpmbuild/BUILD/dlib-65bce59a1512cf222dec01d3e0f29b612dd181f5/dlib/../dlib/dnn/core.h:799:22:
internal compiler error: in redeclare_class_template, at cp/pt.cc:6391
$ /home/dcb38/gcc/results.20230701/bin/gcc -v 2>&1 | grep exp
gcc version 14.0.0 20230630 (experimental) (c3c0ba5436170e01)
$ /home/dcb38/gcc/results.20230703.asan.ubsan/bin/gcc -v 2>&1 | grep exp
gcc version 14.0.0 20230703 (experimental) (9a856f67ee2f13ea)
$ git log c3c0ba5436170e01..9a856f67ee2f13ea | grep -c "^commit"
45
$
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (5 preceding siblings ...)
2023-07-04 10:36 ` dcb314 at hotmail dot com
@ 2023-07-04 11:12 ` dcb314 at hotmail dot com
2023-07-04 12:57 ` dcb314 at hotmail dot com
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-07-04 11:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
--- Comment #6 from David Binderman <dcb314 at hotmail dot com> ---
The only C++ related commit in that range is:
commit db38b285ba61c5b888adc0d117177bfd774c1153
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Jun 30 15:05:22 2023 -0400
c++: fix up caching of level lowered ttps
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (6 preceding siblings ...)
2023-07-04 11:12 ` dcb314 at hotmail dot com
@ 2023-07-04 12:57 ` dcb314 at hotmail dot com
2023-07-04 15:51 ` dcb314 at hotmail dot com
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-07-04 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
--- Comment #7 from David Binderman <dcb314 at hotmail dot com> ---
I have tried to start a git bisect and the current range is
g:f3d87219dd502d5c .. g:9757e4440bd8755d.
This is 15 commits.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (7 preceding siblings ...)
2023-07-04 12:57 ` dcb314 at hotmail dot com
@ 2023-07-04 15:51 ` dcb314 at hotmail dot com
2023-07-10 14:35 ` ppalka at gcc dot gnu.org
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: dcb314 at hotmail dot com @ 2023-07-04 15:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
--- Comment #8 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #7)
> I have tried to start a git bisect and the current range is
> g:f3d87219dd502d5c .. g:9757e4440bd8755d.
>
> This is 15 commits.
I messed this one up and started again. As expected,
Patrick's commit seems to be the one:
$ git bisect bad db38b285ba61c5b8
db38b285ba61c5b888adc0d117177bfd774c1153 is the first bad commit
commit db38b285ba61c5b888adc0d117177bfd774c1153
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Jun 30 15:05:22 2023 -0400
c++: fix up caching of level lowered ttps
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (8 preceding siblings ...)
2023-07-04 15:51 ` dcb314 at hotmail dot com
@ 2023-07-10 14:35 ` ppalka at gcc dot gnu.org
2023-07-10 15:00 ` 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 @ 2023-07-10 14:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
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
--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Simplified:
template<template<class, class> class>
class basic_json;
template<class> struct json_pointer {
template<template<class, class> class> friend class basic_json;
};
template struct json_pointer<int>;
template struct json_pointer<char>;
template struct json_pointer<long>;
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (9 preceding siblings ...)
2023-07-10 14:35 ` ppalka at gcc dot gnu.org
@ 2023-07-10 15:00 ` cvs-commit at gcc dot gnu.org
2023-07-10 15:06 ` ppalka at gcc dot gnu.org
2023-07-10 18:07 ` slyfox at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-10 15:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
--- Comment #10 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:2c60368ab5706a870a1a3be190acc4d673672c30
commit r14-2421-g2c60368ab5706a870a1a3be190acc4d673672c30
Author: Patrick Palka <ppalka@redhat.com>
Date: Mon Jul 10 10:59:40 2023 -0400
c++: redeclare_class_template and ttps [PR110523]
Now that we cache level-lowered ttps we can end up processing the same
ttp multiple times via (multiple calls to) redeclare_class_template, so
we can't assume a ttp's DECL_CONTEXT is initially empty.
PR c++/110523
gcc/cp/ChangeLog:
* pt.cc (redeclare_class_template): Relax the ttp DECL_CONTEXT
assert, and downgrade it to a checking assert.
gcc/testsuite/ChangeLog:
* g++.dg/template/ttp37.C: New test.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (10 preceding siblings ...)
2023-07-10 15:00 ` cvs-commit at gcc dot gnu.org
@ 2023-07-10 15:06 ` ppalka at gcc dot gnu.org
2023-07-10 18:07 ` slyfox at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-07-10 15:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #11 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/110523] [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
` (11 preceding siblings ...)
2023-07-10 15:06 ` ppalka at gcc dot gnu.org
@ 2023-07-10 18:07 ` slyfox at gcc dot gnu.org
12 siblings, 0 replies; 14+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-07-10 18:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110523
--- Comment #12 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
I confirm ICE gone away for json-3.11.2. json-3.11.2 still odes not compile
same as in https://gcc.gnu.org/PR110580
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2023-07-10 18:07 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-02 14:51 [Bug c++/110523] New: [14 Regression] ICE in redeclare_class_template, at cp/pt.cc:6391 on json-3.11.2 slyfox at gcc dot gnu.org
2023-07-02 14:54 ` [Bug c++/110523] " slyfox at gcc dot gnu.org
2023-07-02 17:00 ` pinskia at gcc dot gnu.org
2023-07-02 17:07 ` pinskia at gcc dot gnu.org
2023-07-02 19:10 ` pinskia at gcc dot gnu.org
2023-07-04 10:15 ` dcb314 at hotmail dot com
2023-07-04 10:36 ` dcb314 at hotmail dot com
2023-07-04 11:12 ` dcb314 at hotmail dot com
2023-07-04 12:57 ` dcb314 at hotmail dot com
2023-07-04 15:51 ` dcb314 at hotmail dot com
2023-07-10 14:35 ` ppalka at gcc dot gnu.org
2023-07-10 15:00 ` cvs-commit at gcc dot gnu.org
2023-07-10 15:06 ` ppalka at gcc dot gnu.org
2023-07-10 18:07 ` slyfox 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).