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)