public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034
@ 2020-06-22 15:01 haoxintu at gmail dot com
2020-06-22 15:07 ` [Bug c++/95820] " haoxintu at gmail dot com
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-22 15:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
Bug ID: 95820
Summary: ICE in splice_late_return_type, at cp/pt.c:29034
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
This case bug.cc, reduced by C-Reduce, crashed GCC.
$cat bug.cc
constexpr (*a)()->bool,
$g++ -w -fpermissive small.cc
bug.cc:1:19: internal compiler error: in splice_late_return_type, at
cp/pt.c:29034
1 | constexpr (*a)()->bool,
| ^~~~
0x5cd1f6 splice_late_return_type(tree_node*, tree_node*)
../../gcc/cp/pt.c:29034
0x67db9a grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
../../gcc/cp/decl.c:12154
0x684228 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc/cp/decl.c:5231
0x70c8ce cp_parser_init_declarator
../../gcc/cp/parser.c:20817
0x6efcc2 cp_parser_simple_declaration
../../gcc/cp/parser.c:13785
0x7159c6 cp_parser_declaration
../../gcc/cp/parser.c:13484
0x7160b4 cp_parser_translation_unit
../../gcc/cp/parser.c:4761
0x7160b4 c_parse_file()
../../gcc/cp/parser.c:44034
0x7de74b c_common_parse_file()
../../gcc/c-family/c-opts.c:1190
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
My GCC version is
$g++ --version
g++ (GCC) 11.0.0 20200605 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
@ 2020-06-22 15:07 ` haoxintu at gmail dot com
2020-06-22 15:21 ` mpolacek at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-22 15:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
--- Comment #1 from Haoxin Tu <haoxintu at gmail dot com> ---
(In reply to Haoxin Tu from comment #0)
> $g++ -w -fpermissive small.cc
Here is a mistake, and it should be
$g++ -w -fpermissive bug.cc
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
2020-06-22 15:07 ` [Bug c++/95820] " haoxintu at gmail dot com
@ 2020-06-22 15:21 ` mpolacek at gcc dot gnu.org
2020-06-24 17:05 ` mpolacek at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-22 15:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-06-22
Status|UNCONFIRMED |NEW
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
2020-06-22 15:07 ` [Bug c++/95820] " haoxintu at gmail dot com
2020-06-22 15:21 ` mpolacek at gcc dot gnu.org
@ 2020-06-24 17:05 ` mpolacek at gcc dot gnu.org
2020-06-24 18:50 ` [Bug c++/95820] [10/11 Regression] " mpolacek at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 17:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Hit this when reducing something:
template class a b[]()->int
So it'd be nice to fix it to alleviate problems when reducing C++ code.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] [10/11 Regression] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
` (2 preceding siblings ...)
2020-06-24 17:05 ` mpolacek at gcc dot gnu.org
@ 2020-06-24 18:50 ` mpolacek at gcc dot gnu.org
2020-06-24 19:47 ` mpolacek at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 18:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE in |[10/11 Regression] ICE in
|splice_late_return_type, at |splice_late_return_type, at
|cp/pt.c:29034 |cp/pt.c:29034
Target Milestone|--- |10.2
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r10-6571-ga6ee556c7659877bb59b719f11ca2153e86ded59
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] [10/11 Regression] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
` (3 preceding siblings ...)
2020-06-24 18:50 ` [Bug c++/95820] [10/11 Regression] " mpolacek at gcc dot gnu.org
@ 2020-06-24 19:47 ` mpolacek at gcc dot gnu.org
2020-06-27 14:51 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 19:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] [10/11 Regression] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
` (4 preceding siblings ...)
2020-06-24 19:47 ` mpolacek at gcc dot gnu.org
@ 2020-06-27 14:51 ` mpolacek at gcc dot gnu.org
2020-07-14 13:42 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-27 14:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 95936 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] [10/11 Regression] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
` (5 preceding siblings ...)
2020-06-27 14:51 ` mpolacek at gcc dot gnu.org
@ 2020-07-14 13:42 ` cvs-commit at gcc dot gnu.org
2020-07-14 13:44 ` [Bug c++/95820] [10 " mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-14 13:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:9eb370f19c1198e62d47eae74531e54d0b098bf1
commit r11-2085-g9eb370f19c1198e62d47eae74531e54d0b098bf1
Author: Marek Polacek <polacek@redhat.com>
Date: Wed Jun 24 17:39:21 2020 -0400
c++: Improve checking of decls with trailing return type [PR95820]
This is an ICE-on-invalid but I've been seeing it when reducing
various testcases, so it's more important for me than usually.
splice_late_return_type now checks that if we've seen a late return
type, the function return type was auto. That's a fair assumption
but grokdeclarator/cdk_function wasn't giving errors for function
pointers and similar. So we want to perform various checks not only
when funcdecl_p || inner_declarator == NULL. But only give the
!late_return_type errors when funcdecl_p, to accept e.g.
auto (*fp)() = f;
in C++11. Here's a diff -w to ease the review:
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12102,14 +12102,9 @@ grokdeclarator (const cp_declarator *declarator,
/* Handle a late-specified return type. */
tree late_return_type =
declarator->u.function.late_return_type;
- if (funcdecl_p
- /* This is the case e.g. for
- using T = auto () -> int. */
- || inner_declarator == NULL)
- {
if (tree auto_node = type_uses_auto (type))
{
- if (!late_return_type)
+ if (!late_return_type && funcdecl_p)
{
if (current_class_type
&& LAMBDA_TYPE_P (current_class_type))
@@ -12201,7 +12196,6 @@ grokdeclarator (const cp_declarator *declarator,
"type specifier", name);
return error_mark_node;
}
- }
type = splice_late_return_type (type, late_return_type);
if (type == error_mark_node)
return error_mark_node;
gcc/cp/ChangeLog:
PR c++/95820
* decl.c (grokdeclarator) <case cdk_function>: Check also
pointers/references/... to functions.
gcc/testsuite/ChangeLog:
PR c++/95820
* g++.dg/cpp1y/auto-fn58.C: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] [10 Regression] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
` (6 preceding siblings ...)
2020-07-14 13:42 ` cvs-commit at gcc dot gnu.org
@ 2020-07-14 13:44 ` mpolacek at gcc dot gnu.org
2020-07-26 18:43 ` slyfox at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-14 13:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11 Regression] ICE in |[10 Regression] ICE in
|splice_late_return_type, at |splice_late_return_type, at
|cp/pt.c:29034 |cp/pt.c:29034
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed in GCC 11.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] [10 Regression] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
` (7 preceding siblings ...)
2020-07-14 13:44 ` [Bug c++/95820] [10 " mpolacek at gcc dot gnu.org
@ 2020-07-26 18:43 ` slyfox at gcc dot gnu.org
2020-07-27 1:06 ` mpolacek at gcc dot gnu.org
2020-07-27 7:08 ` slyfox at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: slyfox at gcc dot gnu.org @ 2020-07-26 18:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |slyfox at gcc dot gnu.org
--- Comment #8 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
In https://bugs.gentoo.org/730406 we see it on gcc-10.2.0 as well. Minimal
example:
$ cat a.cc
template <long()()->decltype(0)
$ LANG=C gcc-10.2.0 a.cc
a.cc:1:21: internal compiler error: in splice_late_return_type, at
cp/pt.c:29152
Should it be backported to gcc-10?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] [10 Regression] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
` (8 preceding siblings ...)
2020-07-26 18:43 ` slyfox at gcc dot gnu.org
@ 2020-07-27 1:06 ` mpolacek at gcc dot gnu.org
2020-07-27 7:08 ` slyfox at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-07-27 1:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We usually don't backport fixed for ices-on-invalid but I could be convinced in
this case.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/95820] [10 Regression] ICE in splice_late_return_type, at cp/pt.c:29034
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
` (9 preceding siblings ...)
2020-07-27 1:06 ` mpolacek at gcc dot gnu.org
@ 2020-07-27 7:08 ` slyfox at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: slyfox at gcc dot gnu.org @ 2020-07-27 7:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95820
Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.2 |11.0
--- Comment #10 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Oh, that makes sense. Adjusting the Target to 11.0.
I don't feel strongly about it either. We did not get reports until 10.2, so
maybe it's not that frequent.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-07-27 7:08 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 15:01 [Bug c++/95820] New: ICE in splice_late_return_type, at cp/pt.c:29034 haoxintu at gmail dot com
2020-06-22 15:07 ` [Bug c++/95820] " haoxintu at gmail dot com
2020-06-22 15:21 ` mpolacek at gcc dot gnu.org
2020-06-24 17:05 ` mpolacek at gcc dot gnu.org
2020-06-24 18:50 ` [Bug c++/95820] [10/11 Regression] " mpolacek at gcc dot gnu.org
2020-06-24 19:47 ` mpolacek at gcc dot gnu.org
2020-06-27 14:51 ` mpolacek at gcc dot gnu.org
2020-07-14 13:42 ` cvs-commit at gcc dot gnu.org
2020-07-14 13:44 ` [Bug c++/95820] [10 " mpolacek at gcc dot gnu.org
2020-07-26 18:43 ` slyfox at gcc dot gnu.org
2020-07-27 1:06 ` mpolacek at gcc dot gnu.org
2020-07-27 7:08 ` 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).