From b6ed546bdf40a99f3651c1f8f9806d851649d011 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 1 Jul 2020 11:36:01 -0400 Subject: [PATCH 270/377] FIXME: fix torture/intptr_t.c --- gcc/analyzer/region-model2.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/analyzer/region-model2.cc b/gcc/analyzer/region-model2.cc index 34bab43e1de..72b77fcff74 100644 --- a/gcc/analyzer/region-model2.cc +++ b/gcc/analyzer/region-model2.cc @@ -3331,6 +3331,16 @@ region_model2_manager::maybe_fold_unaryop (tree type, enum tree_code op, if (arg->get_type () && useless_type_conversion_p (arg->get_type (), type)) return arg; + + /* Fold "cast (cast (innermost_arg)) + => "cast (innermost_arg)", + unless INNER_TYPE is narrower than TYPE. */ + if (const svalue2 *innermost_arg = arg->maybe_undo_cast ()) + { + tree inner_type = arg->get_type (); + if (TYPE_PRECISION (type) <= TYPE_PRECISION (inner_type)) + return maybe_fold_unaryop (type, op, innermost_arg); + } } break; case TRUTH_NOT_EXPR: -- 2.26.2