summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-06-14 11:10:13 +0200
committerRichard Biener <rguenther@suse.de>2022-07-19 11:24:23 +0200
commit92aa9490315d969d6e7580fb6e8d006415877bd6 (patch)
treede3762b9f4d716d5e4de6cc1f9531ef021381aee
parent4ed850a568e4d27a2df566f13843714ca80d437e (diff)
tree-optimization/105946 - avoid accessing excess args from uninit diag
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. (cherry picked from commit e07a876c07601e1f3a27420f7d055d20193c362c)
-rw-r--r--gcc/tree-ssa-uninit.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/tree-ssa-uninit.cc b/gcc/tree-ssa-uninit.cc
index b48fcf1a8ba..f326f1775c0 100644
--- a/gcc/tree-ssa-uninit.cc
+++ b/gcc/tree-ssa-uninit.cc
@@ -797,6 +797,9 @@ maybe_warn_pass_by_reference (gcall *stmt, wlimits &wlims)
{
++argno;
+ if (argno > nargs)
+ break;
+
if (!POINTER_TYPE_P (argtype))
continue;