From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2209) id 8A4DD3858C2F; Mon, 15 Aug 2022 18:48:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A4DD3858C2F MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: David Malcolm To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2053] analyzer: better fix for -Wanalyzer-use-of-uninitialized-value [PR106573] X-Act-Checkin: gcc X-Git-Author: David Malcolm X-Git-Refname: refs/heads/master X-Git-Oldrev: 265cdd067afd56293137ecb3057c5ba28a7c9480 X-Git-Newrev: ca123e019bb92fd1d6909e8da7f53a4f45922526 Message-Id: <20220815184851.8A4DD3858C2F@sourceware.org> Date: Mon, 15 Aug 2022 18:48:51 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2022 18:48:51 -0000 https://gcc.gnu.org/g:ca123e019bb92fd1d6909e8da7f53a4f45922526 commit r13-2053-gca123e019bb92fd1d6909e8da7f53a4f45922526 Author: David Malcolm Date: Mon Aug 15 14:47:02 2022 -0400 analyzer: better fix for -Wanalyzer-use-of-uninitialized-value [PR106573] gcc/analyzer/ChangeLog: PR analyzer/106573 * region-model.cc (region_model::on_call_pre): Use check_call_args when ensuring that we call get_arg_svalue on all args. Remove redundant call from handling for stdio builtins. Signed-off-by: David Malcolm Diff: --- gcc/analyzer/region-model.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index 7e7077696f7..a58904c06a8 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -1768,8 +1768,7 @@ region_model::on_call_pre (const gcall *call, region_model_context *ctxt, duplicates if any of the handling below also looks up the svalues, but the deduplication code should deal with that. */ if (ctxt) - for (unsigned arg_idx = 0; arg_idx < cd.num_args (); arg_idx++) - cd.get_arg_svalue (arg_idx); + check_call_args (cd); /* Some of the cases below update the lhs of the call based on the return value, but not all. Provide a default value, which may @@ -1889,7 +1888,6 @@ region_model::on_call_pre (const gcall *call, region_model_context *ctxt, /* These stdio builtins have external effects that are out of scope for the analyzer: we only want to model the effects on the return value. */ - check_call_args (cd); break; case BUILT_IN_VA_START: