]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/105946 - avoid accessing excess args from uninit diag
authorRichard Biener <rguenther@suse.de>
Tue, 14 Jun 2022 09:10:13 +0000 (11:10 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 14 Jun 2022 10:52:49 +0000 (12:52 +0200)
uninit diagnostics uses passing via reference and access attributes
but that iterates over function type arguments which can in some
cases appearantly outrun the actual arguments leading to ICEs.
The following simply ignores not present arguments.

2022-06-14  Richard Biener  <rguenther@suse.de>

PR tree-optimization/105946
* tree-ssa-uninit.cc (maybe_warn_pass_by_reference):
Do not look at arguments not specified in the function call.

gcc/tree-ssa-uninit.cc

index b48fcf1a8ba71a15cd893281678df9fb1359cfe7..f326f1775c0ab62b8d6ab38d5f696633a320a7ab 100644 (file)
@@ -797,6 +797,9 @@ maybe_warn_pass_by_reference (gcall *stmt, wlimits &wlims)
     {
       ++argno;
 
+      if (argno > nargs)
+       break;
+
       if (!POINTER_TYPE_P (argtype))
        continue;