analyzer: fix folding of '(PTR + 0) => PTR' [PR105784]

gcc/analyzer/ChangeLog:
	PR analyzer/105784
	* region-model-manager.cc
	(region_model_manager::maybe_fold_binop): For POINTER_PLUS_EXPR,
	PLUS_EXPR and MINUS_EXPR, eliminate requirement that the final
	type matches that of arg0 in favor of a cast.

gcc/testsuite/ChangeLog:
	PR analyzer/105784
	* gcc.dg/analyzer/torture/fold-ptr-arith-pr105784.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 files changed