On Tue, Feb 17, 2026 at 10:49 PM Roger Sayle <[email protected]> wrote:
>
>
> This patch resolves PR c/119651 and PR c/123716 P4 regressions.
> Tested on x86_64-pc-linux-gnu with make bootstrap and make -k check
> with no new regressions. Ok for mainline?
The tree_nop_conversion_p change looks OK. I wonder where we
build the CONVERT_EXPR with error operands though, ideally we'd
not do this but build error_mark_node for itself. And instead of
CASE_CONVERT:
+ if (TREE_TYPE (t) == error_mark_node
this sub-check I'd check
if (!error_operand_p (t))
around the switch.
+ || TREE_TYPE (TREE_OPERAND (t, 0)) == error_mark_node)
+ break;
>
> 2026-02-17 Roger Sayle <[email protected]>
>
> gcc/ChangeLog
> PR c/119651
> PR c/123716
> * fold-const.cc (tree_nonzero_bits) <case CONVERT>: Check both
> the inner and outer types are not error_mark_node.
> * tree.cc (tree_nop_conversion_p): Move sanity checks on
> inner_type to here...
> (tree_nop_conversion): .. from here.
>
> gcc/testsuite/ChangeLog
> PR c/119651
> PR c/123716
> * gcc.dg/pr119651.c: New test case.
> * gcc.dg/pr123716.c: Likewise.
>
> Roger
> --
>