public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant
@ 2021-04-15 14:52 reichelt at gcc dot gnu.org
2021-04-15 15:38 ` [Bug c++/100101] " ppalka at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: reichelt at gcc dot gnu.org @ 2021-04-15 14:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
Bug ID: 100101
Summary: [11 Regression] ICE with
-Wzero-as-null-pointer-constant
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
Target Milestone: ---
Compiling the following valid code snippet with
"-Wzero-as-null-pointer-constant" triggers an assertion on trunk.
This is a recent regression from within the last month.
==============================================================================
template <typename T> struct A
{
template <typename U> static char foo(U*, int* = 0);
static const bool value = sizeof(foo(static_cast<T*>(nullptr))) > 0;
};
template <bool b> struct B
{
static const bool value = b;
};
template <typename T> struct C
{
typedef B<A<T>::value> type;
};
template <typename T>
void bar() noexcept(A<T>::value && C<T>::type::value) {}
void baz()
{
bar<void>();
}
==============================================================================
'
Internal compiler error: Error reporting routines re-entered.
0x8cfbf8 convert_default_arg(tree_node*, tree_node*, tree_node*, int, int)
../../gcc/gcc/cp/call.c:8348
0x8dc177 build_over_call
../../gcc/gcc/cp/call.c:9230
0x8da248 build_new_method_call_1
../../gcc/gcc/cp/call.c:10783
0x8db2af build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
../../gcc/gcc/cp/call.c:10858
0xae76dd finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2751
0xa99115 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:20484
0xa969ec tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19958
0xa957f3 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19876
0xaa0e48 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:19164
0xaaaa06 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:26117
0x98fc9a maybe_instantiate_decl(tree_node*)
../../gcc/gcc/cp/decl2.c:5460
0x990ff8 maybe_instantiate_decl(tree_node*)
../../gcc/gcc/cp/decl2.c:5663
0x990ff8 mark_used(tree_node*, int)
../../gcc/gcc/cp/decl2.c:5689
0xa951f0 tsubst_qualified_id
../../gcc/gcc/cp/pt.c:16466
0xa96ee8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:19914
0xaa0e48 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:19164
0xab59ce tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:13384
0xabed23 tsubst_aggr_type
../../gcc/gcc/cp/pt.c:13587
0xa9dd10 tsubst_decl
../../gcc/gcc/cp/pt.c:14847
0xacc3dd instantiate_class_template_1
../../gcc/gcc/cp/pt.c:12031
Please submit a full bug report, [etc.]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/100101] [11 Regression] ICE with -Wzero-as-null-pointer-constant
2021-04-15 14:52 [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant reichelt at gcc dot gnu.org
@ 2021-04-15 15:38 ` ppalka at gcc dot gnu.org
2021-04-15 15:51 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-15 15:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Target Milestone|--- |11.0
Last reconfirmed| |2021-04-15
Ever confirmed|0 |1
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Seems to have started with r11-7953.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/100101] [11 Regression] ICE with -Wzero-as-null-pointer-constant
2021-04-15 14:52 [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant reichelt at gcc dot gnu.org
2021-04-15 15:38 ` [Bug c++/100101] " ppalka at gcc dot gnu.org
@ 2021-04-15 15:51 ` jakub at gcc dot gnu.org
2021-04-15 15:57 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-15 15:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
CC| |jakub at gcc dot gnu.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/100101] [11 Regression] ICE with -Wzero-as-null-pointer-constant
2021-04-15 14:52 [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant reichelt at gcc dot gnu.org
2021-04-15 15:38 ` [Bug c++/100101] " ppalka at gcc dot gnu.org
2021-04-15 15:51 ` jakub at gcc dot gnu.org
@ 2021-04-15 15:57 ` jakub at gcc dot gnu.org
2021-04-15 16:43 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-15 15:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So maybe find_typenames doesn't want to walk into TYPE_RAISES_EXCEPTIONS?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/100101] [11 Regression] ICE with -Wzero-as-null-pointer-constant
2021-04-15 14:52 [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant reichelt at gcc dot gnu.org
` (2 preceding siblings ...)
2021-04-15 15:57 ` jakub at gcc dot gnu.org
@ 2021-04-15 16:43 ` jakub at gcc dot gnu.org
2021-04-15 17:09 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-15 16:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
In particular it is the TYPENAME_TYPE type seen in bar's noexcept expression.
Does find_typenames_r ever want to walk into expressions?
I.e. couldn't the fix be
if (EXPR_P (*tp))
*walk_subtrees = 0;
?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/100101] [11 Regression] ICE with -Wzero-as-null-pointer-constant
2021-04-15 14:52 [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant reichelt at gcc dot gnu.org
` (3 preceding siblings ...)
2021-04-15 16:43 ` jakub at gcc dot gnu.org
@ 2021-04-15 17:09 ` jason at gcc dot gnu.org
2021-04-15 17:11 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-15 17:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/100101] [11 Regression] ICE with -Wzero-as-null-pointer-constant
2021-04-15 14:52 [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant reichelt at gcc dot gnu.org
` (4 preceding siblings ...)
2021-04-15 17:09 ` jason at gcc dot gnu.org
@ 2021-04-15 17:11 ` jakub at gcc dot gnu.org
2021-04-15 19:03 ` cvs-commit at gcc dot gnu.org
2021-04-15 19:04 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-15 17:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/cp/error.c.jj 2021-02-25 23:27:46.561918450 +0100
+++ gcc/cp/error.c 2021-04-15 19:10:38.389850343 +0200
@@ -1554,10 +1554,12 @@ find_typenames_r (tree *tp, int *walk_su
/* Add the typename without any cv-qualifiers. */
mv = TYPE_MAIN_VARIANT (*tp);
- if (PACK_EXPANSION_P (*tp))
+ if (PACK_EXPANSION_P (*tp) || EXPR_P (*tp))
{
/* Don't mess with parameter packs since we don't remember
- the pack expansion context for a particular typename. */
+ the pack expansion context for a particular typename.
+ Similarly, don't walk into expressions such as
+ those inside of TYPE_RAISES_EXCEPTIONS. */
*walk_subtrees = false;
return NULL_TREE;
}
passed make check-c++-all and fixes the testcase.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/100101] [11 Regression] ICE with -Wzero-as-null-pointer-constant
2021-04-15 14:52 [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant reichelt at gcc dot gnu.org
` (5 preceding siblings ...)
2021-04-15 17:11 ` jakub at gcc dot gnu.org
@ 2021-04-15 19:03 ` cvs-commit at gcc dot gnu.org
2021-04-15 19:04 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-15 19:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:2efbbba16a0630fac8cadcd6d9e0ffaabfadb79f
commit r11-8201-g2efbbba16a0630fac8cadcd6d9e0ffaabfadb79f
Author: Jason Merrill <jason@redhat.com>
Date: Thu Apr 15 13:38:54 2021 -0400
c++: noexcept error recursion [PR100101]
Here instantiating the noexcept-specifier for bar<void>() means
instantiating A<void>::value, which complains about the conversion from 0
to
int* in the default argument of foo. Since my patch for PR99583, printing
the error context involves looking at C<void>::type, which again wants to
instantiate A<void>::value, which breaks. For now at least, let's break
this recursion by avoiding looking into the noexcept-specifier in
find_typenames, and limit that to just the uses_parameter_packs case that
PR99583 cares about.
gcc/cp/ChangeLog:
PR c++/100101
PR c++/99583
* pt.c (find_parameter_packs_r) [FUNCTION_TYPE]: Walk into
TYPE_RAISES_EXCEPTIONS here.
* tree.c (cp_walk_subtrees): Not here.
gcc/testsuite/ChangeLog:
PR c++/100101
* g++.dg/cpp0x/noexcept67.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/100101] [11 Regression] ICE with -Wzero-as-null-pointer-constant
2021-04-15 14:52 [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant reichelt at gcc dot gnu.org
` (6 preceding siblings ...)
2021-04-15 19:03 ` cvs-commit at gcc dot gnu.org
@ 2021-04-15 19:04 ` jason at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-15 19:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100101
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-04-15 19:04 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 14:52 [Bug c++/100101] New: [11 Regression] ICE with -Wzero-as-null-pointer-constant reichelt at gcc dot gnu.org
2021-04-15 15:38 ` [Bug c++/100101] " ppalka at gcc dot gnu.org
2021-04-15 15:51 ` jakub at gcc dot gnu.org
2021-04-15 15:57 ` jakub at gcc dot gnu.org
2021-04-15 16:43 ` jakub at gcc dot gnu.org
2021-04-15 17:09 ` jason at gcc dot gnu.org
2021-04-15 17:11 ` jakub at gcc dot gnu.org
2021-04-15 19:03 ` cvs-commit at gcc dot gnu.org
2021-04-15 19:04 ` jason 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).