public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106311] New: internal compiler error in redeclare_class_template
@ 2022-07-15 0:05 mpolacek at gcc dot gnu.org
2022-07-15 0:06 ` [Bug c++/106311] [12/13 Regression] " mpolacek at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-07-15 0:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106311
Bug ID: 106311
Summary: internal compiler error in redeclare_class_template
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
Found while reducing bug 106309.
template <typename, long> struct array;
template <typename, size_t X> struct array { };
$ ./cc1plus -quiet p.C
p.C:2:21: error: ‘size_t’ has not been declared
2 | template <typename, size_t X> struct array { };
| ^~~~~~
p.C:1:21: error: template parameter ‘long int <anonymous>’
1 | template <typename, long> struct array;
| ^~~~
p.C:2:38: internal compiler error: tree check: expected tree that contains
‘decl minimal’ structure, have ‘error_mark’ in redeclare_class_template, at
cp/pt.cc:6380
2 | template <typename, size_t X> struct array { };
| ^~~~~
0x1bcc50c tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
/home/mpolacek/src/gcc/gcc/tree.cc:8991
0xb06dc6 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
/home/mpolacek/src/gcc/gcc/tree.h:3622
0xe136e1 redeclare_class_template(tree_node*, tree_node*, tree_node*)
/home/mpolacek/src/gcc/gcc/cp/pt.cc:6380
0xc40a20 xref_tag(tag_types, tree_node*, TAG_how, bool)
/home/mpolacek/src/gcc/gcc/cp/decl.cc:15869
0xdaafdd cp_parser_class_head
/home/mpolacek/src/gcc/gcc/cp/parser.cc:26785
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/106311] [12/13 Regression] internal compiler error in redeclare_class_template
2022-07-15 0:05 [Bug c++/106311] New: internal compiler error in redeclare_class_template mpolacek at gcc dot gnu.org
@ 2022-07-15 0:06 ` mpolacek at gcc dot gnu.org
2022-07-26 12:04 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-07-15 0:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106311
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Target Milestone|--- |12.2
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2022-07-15
Summary|internal compiler error in |[12/13 Regression] internal
|redeclare_class_template |compiler error in
| |redeclare_class_template
Keywords| |ice-on-invalid-code
Priority|P3 |P2
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r12-7562. Patch:
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -6377,7 +6377,8 @@ redeclare_class_template (tree type, tree parms, tree
cons)
{
auto_diagnostic_group d;
error ("template parameter %q+#D", tmpl_parm);
- inform (DECL_SOURCE_LOCATION (parm), "redeclared here as %q#D", parm);
+ inform (DECL_P (parm) ? DECL_SOURCE_LOCATION (parm) : input_location,
+ "redeclared here as %q#D", parm);
return false;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/106311] [12/13 Regression] internal compiler error in redeclare_class_template
2022-07-15 0:05 [Bug c++/106311] New: internal compiler error in redeclare_class_template mpolacek at gcc dot gnu.org
2022-07-15 0:06 ` [Bug c++/106311] [12/13 Regression] " mpolacek at gcc dot gnu.org
@ 2022-07-26 12:04 ` cvs-commit at gcc dot gnu.org
2022-07-26 13:22 ` cvs-commit at gcc dot gnu.org
2022-07-26 13:24 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-26 12:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106311
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:2333b58c9892667545d0c2c3ecd2d7b947197511
commit r13-1841-g2333b58c9892667545d0c2c3ecd2d7b947197511
Author: Marek Polacek <polacek@redhat.com>
Date: Fri Jul 15 09:51:50 2022 -0400
c++: ICE with erroneous template redeclaration [PR106311]
Here we ICE trying to get DECL_SOURCE_LOCATION of the parm that happens
to be error_mark_node in this ill-formed test. I kept running into this
while reducing code, so it'd be good to have it fixed.
PR c++/106311
gcc/cp/ChangeLog:
* pt.cc (redeclare_class_template): Check DECL_P before accessing
DECL_SOURCE_LOCATION.
gcc/testsuite/ChangeLog:
* g++.dg/template/redecl5.C: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/106311] [12/13 Regression] internal compiler error in redeclare_class_template
2022-07-15 0:05 [Bug c++/106311] New: internal compiler error in redeclare_class_template mpolacek at gcc dot gnu.org
2022-07-15 0:06 ` [Bug c++/106311] [12/13 Regression] " mpolacek at gcc dot gnu.org
2022-07-26 12:04 ` cvs-commit at gcc dot gnu.org
@ 2022-07-26 13:22 ` cvs-commit at gcc dot gnu.org
2022-07-26 13:24 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-26 13:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106311
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:9be0feeadeeac2166fbe3823421bc5712bc59087
commit r12-8619-g9be0feeadeeac2166fbe3823421bc5712bc59087
Author: Marek Polacek <polacek@redhat.com>
Date: Fri Jul 15 09:51:50 2022 -0400
c++: ICE with erroneous template redeclaration [PR106311]
Here we ICE trying to get DECL_SOURCE_LOCATION of the parm that happens
to be error_mark_node in this ill-formed test. I kept running into this
while reducing code, so it'd be good to have it fixed.
PR c++/106311
gcc/cp/ChangeLog:
* pt.cc (redeclare_class_template): Check DECL_P before accessing
DECL_SOURCE_LOCATION.
gcc/testsuite/ChangeLog:
* g++.dg/template/redecl5.C: New test.
(cherry picked from commit 2333b58c9892667545d0c2c3ecd2d7b947197511)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/106311] [12/13 Regression] internal compiler error in redeclare_class_template
2022-07-15 0:05 [Bug c++/106311] New: internal compiler error in redeclare_class_template mpolacek at gcc dot gnu.org
` (2 preceding siblings ...)
2022-07-26 13:22 ` cvs-commit at gcc dot gnu.org
@ 2022-07-26 13:24 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-07-26 13:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106311
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-26 13:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-15 0:05 [Bug c++/106311] New: internal compiler error in redeclare_class_template mpolacek at gcc dot gnu.org
2022-07-15 0:06 ` [Bug c++/106311] [12/13 Regression] " mpolacek at gcc dot gnu.org
2022-07-26 12:04 ` cvs-commit at gcc dot gnu.org
2022-07-26 13:22 ` cvs-commit at gcc dot gnu.org
2022-07-26 13:24 ` mpolacek 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).