public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101592] New: ICE in wide_int_to_tree, at tree.c:1427
@ 2021-07-23 4:36 marxin at gcc dot gnu.org
2021-07-23 14:05 ` [Bug c++/101592] " mpolacek at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-07-23 4:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592
Bug ID: 101592
Summary: ICE in wide_int_to_tree, at tree.c:1427
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
Target Milestone: ---
The following ICEs:
$ g++ /home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp0x/nullptr46.C
-Wlogical-op
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp0x/nullptr46.C: In
function ‘bool bar()’:
/home/marxin/Programming/gcc/gcc/testsuite/g++.dg/cpp0x/nullptr46.C:10:39:
internal compiler error: in wide_int_to_tree_1, at tree.c:1716
10 | return foo () > nullptr || foo () < nullptr;
| ^~~~~~~
0x89bab5 wide_int_to_tree_1
/home/marxin/Programming/gcc/gcc/tree.c:1716
0x14a4510 build_int_cst(tree_node*, poly_int<1u, long>)
/home/marxin/Programming/gcc/gcc/tree.c:1505
0xe614aa range_successor
/home/marxin/Programming/gcc/gcc/fold-const.c:5510
0xe61a47 merge_ranges(int*, tree_node**, tree_node**, int, tree_node*,
tree_node*, int, tree_node*, tree_node*)
/home/marxin/Programming/gcc/gcc/fold-const.c:5646
0xe65345 make_range_step(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*, tree_node**, tree_node**, int*, bool*)
/home/marxin/Programming/gcc/gcc/fold-const.c:5047
0xe658fe make_range(tree_node*, int*, tree_node**, tree_node**, bool*)
/home/marxin/Programming/gcc/gcc/fold-const.c:5293
0xc842c2 warn_logical_operator(unsigned int, tree_code, tree_node*, tree_code,
tree_node*, tree_code, tree_node*)
/home/marxin/Programming/gcc/gcc/c-family/c-warn.c:265
0x984fa7 build_new_op_1
/home/marxin/Programming/gcc/gcc/cp/call.c:6730
0x9853d1 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node**, int)
/home/marxin/Programming/gcc/gcc/cp/call.c:6806
0xbd614f build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node**, int)
/home/marxin/Programming/gcc/gcc/cp/typeck.c:4330
0xae8bc4 cp_parser_binary_expression
/home/marxin/Programming/gcc/gcc/cp/parser.c:10038
0xae93cc cp_parser_assignment_expression
/home/marxin/Programming/gcc/gcc/cp/parser.c:10176
0xaeaa6a cp_parser_expression
/home/marxin/Programming/gcc/gcc/cp/parser.c:10346
0xafa7c8 cp_parser_jump_statement
/home/marxin/Programming/gcc/gcc/cp/parser.c:13872
0xafa7c8 cp_parser_statement
/home/marxin/Programming/gcc/gcc/cp/parser.c:11950
0xafb4ae cp_parser_statement_seq_opt
/home/marxin/Programming/gcc/gcc/cp/parser.c:12433
0xafb5a0 cp_parser_compound_statement
/home/marxin/Programming/gcc/gcc/cp/parser.c:12382
0xb1a137 cp_parser_function_body
/home/marxin/Programming/gcc/gcc/cp/parser.c:24448
0xb1a137 cp_parser_ctor_initializer_opt_and_function_body
/home/marxin/Programming/gcc/gcc/cp/parser.c:24499
0xb1bdaa cp_parser_function_definition_after_declarator
/home/marxin/Programming/gcc/gcc/cp/parser.c:30572
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
2021-07-23 4:36 [Bug c++/101592] New: ICE in wide_int_to_tree, at tree.c:1427 marxin at gcc dot gnu.org
@ 2021-07-23 14:05 ` mpolacek at gcc dot gnu.org
2021-07-23 14:19 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-07-23 14:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
CC| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2021-07-23
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Taking: will be fixed with my patch
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575580.html
$ xg++ -c nullptr46.C -Wlogical-op
nullptr46.C: In function ‘bool bar()’:
nullptr46.C:10:17: error: ordered comparison of pointer with integer zero
(‘std::nullptr_t’ and ‘std::nullptr_t’)
10 | return foo () > nullptr || foo () < nullptr;
| ~~~~~~~^~~~~~~~~
nullptr46.C:10:37: error: ordered comparison of pointer with integer zero
(‘std::nullptr_t’ and ‘std::nullptr_t’)
10 | return foo () > nullptr || foo () < nullptr;
| ~~~~~~~^~~~~~~~~
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
2021-07-23 4:36 [Bug c++/101592] New: ICE in wide_int_to_tree, at tree.c:1427 marxin at gcc dot gnu.org
2021-07-23 14:05 ` [Bug c++/101592] " mpolacek at gcc dot gnu.org
@ 2021-07-23 14:19 ` jakub at gcc dot gnu.org
2021-07-23 14:30 ` mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-23 14:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
True, but only on the trunk, I assume we don't want to backport changes which
will reject previously accepted (albeit invalid) code.
I think for gcc 11 we want to return NULL_TREE in fold_const.c
(make_range_step) in the comparison cases if TREE_CODE (arg0_type) ==
NULLPTR_TYPE.
Completely untested:
--- gcc/fold-const.c 2021-07-15 18:50:52.590821814 +0200
+++ gcc/fold-const.c 2021-07-23 16:19:20.983128939 +0200
@@ -5010,7 +5010,8 @@ make_range_step (location_t loc, enum tr
being not equal to zero; "out" is leaving it alone. */
if (low == NULL_TREE || high == NULL_TREE
|| ! integer_zerop (low) || ! integer_zerop (high)
- || TREE_CODE (arg1) != INTEGER_CST)
+ || TREE_CODE (arg1) != INTEGER_CST
+ || TREE_CODE (arg0_type) == NULLPTR_TYPE)
return NULL_TREE;
switch (code)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
2021-07-23 4:36 [Bug c++/101592] New: ICE in wide_int_to_tree, at tree.c:1427 marxin at gcc dot gnu.org
2021-07-23 14:05 ` [Bug c++/101592] " mpolacek at gcc dot gnu.org
2021-07-23 14:19 ` jakub at gcc dot gnu.org
@ 2021-07-23 14:30 ` mpolacek at gcc dot gnu.org
2021-09-01 19:19 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-07-23 14:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thanks, I'll test that sometime soon.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
2021-07-23 4:36 [Bug c++/101592] New: ICE in wide_int_to_tree, at tree.c:1427 marxin at gcc dot gnu.org
` (2 preceding siblings ...)
2021-07-23 14:30 ` mpolacek at gcc dot gnu.org
@ 2021-09-01 19:19 ` cvs-commit at gcc dot gnu.org
2021-09-01 21:34 ` cvs-commit at gcc dot gnu.org
2021-09-01 21:35 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-01 19:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592
--- Comment #4 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:7c5003c6873a941ef75fd31be85dbd37af1fcd23
commit r12-3297-g7c5003c6873a941ef75fd31be85dbd37af1fcd23
Author: Marek Polacek <polacek@redhat.com>
Date: Wed Sep 1 15:17:07 2021 -0400
c++: Add test for fixed PR [PR101592]
Fixed by my c++/99701 patch.
PR c++/101592
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wlogical-op-3.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
2021-07-23 4:36 [Bug c++/101592] New: ICE in wide_int_to_tree, at tree.c:1427 marxin at gcc dot gnu.org
` (3 preceding siblings ...)
2021-09-01 19:19 ` cvs-commit at gcc dot gnu.org
@ 2021-09-01 21:34 ` cvs-commit at gcc dot gnu.org
2021-09-01 21:35 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-01 21:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:adee9b8a80cc985c7a0ede592fe07b131303343a
commit r11-8949-gadee9b8a80cc985c7a0ede592fe07b131303343a
Author: Marek Polacek <polacek@redhat.com>
Date: Wed Sep 1 16:47:44 2021 -0400
c++: Fix ICE with nullptr comparison (GCC 11) [PR101592]
On trunk, PR101592 was fixed by r12-2537, but that change shouldn't be
backported to GCC 11. In the PR Jakub suggested this fix, so here it
is, after the usual testing.
PR c++/101592
gcc/ChangeLog:
* fold-const.c (make_range_step): Return NULL_TREE for
NULLPTR_TYPE.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wlogical-op-3.C: New test.
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
2021-07-23 4:36 [Bug c++/101592] New: ICE in wide_int_to_tree, at tree.c:1427 marxin at gcc dot gnu.org
` (4 preceding siblings ...)
2021-09-01 21:34 ` cvs-commit at gcc dot gnu.org
@ 2021-09-01 21:35 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-09-01 21:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-01 21:35 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 4:36 [Bug c++/101592] New: ICE in wide_int_to_tree, at tree.c:1427 marxin at gcc dot gnu.org
2021-07-23 14:05 ` [Bug c++/101592] " mpolacek at gcc dot gnu.org
2021-07-23 14:19 ` jakub at gcc dot gnu.org
2021-07-23 14:30 ` mpolacek at gcc dot gnu.org
2021-09-01 19:19 ` cvs-commit at gcc dot gnu.org
2021-09-01 21:34 ` cvs-commit at gcc dot gnu.org
2021-09-01 21:35 ` 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).