]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: better fix for -Wanalyzer-use-of-uninitialized-value [PR106573]
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 15 Aug 2022 18:47:02 +0000 (14:47 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 15 Aug 2022 18:47:02 +0000 (14:47 -0400)
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 <dmalcolm@redhat.com>
gcc/analyzer/region-model.cc

index 7e7077696f7a079db8cf1d144359edf8fb11285f..a58904c06a8a2c0d8340c722456c597c570c3071 100644 (file)
@@ -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: