[Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592 Marek Polacek 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 --- 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; | ~~~^
[Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek --- 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.c2021-07-15 18:50:52.590821814 +0200 +++ gcc/fold-const.c2021-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)
[Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592 --- Comment #3 from Marek Polacek --- Thanks, I'll test that sometime soon.
[Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592 --- Comment #4 from CVS Commits --- The trunk branch has been updated by Marek Polacek : https://gcc.gnu.org/g:7c5003c6873a941ef75fd31be85dbd37af1fcd23 commit r12-3297-g7c5003c6873a941ef75fd31be85dbd37af1fcd23 Author: Marek Polacek 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.
[Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592 --- Comment #5 from CVS Commits --- The releases/gcc-11 branch has been updated by Marek Polacek : https://gcc.gnu.org/g:adee9b8a80cc985c7a0ede592fe07b131303343a commit r11-8949-gadee9b8a80cc985c7a0ede592fe07b131303343a Author: Marek Polacek 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
[Bug c++/101592] ICE in wide_int_to_tree, at tree.c:1427
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101592 Marek Polacek changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #6 from Marek Polacek --- Fixed.