From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id B2C6A3857BA1; Tue, 19 Jul 2022 11:37:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2C6A3857BA1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-8577] tree-optimization/105946 - avoid accessing excess args from uninit diag X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 4ed850a568e4d27a2df566f13843714ca80d437e X-Git-Newrev: 92aa9490315d969d6e7580fb6e8d006415877bd6 Message-Id: <20220719113757.B2C6A3857BA1@sourceware.org> Date: Tue, 19 Jul 2022 11:37:57 +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: Tue, 19 Jul 2022 11:37:57 -0000 https://gcc.gnu.org/g:92aa9490315d969d6e7580fb6e8d006415877bd6 commit r12-8577-g92aa9490315d969d6e7580fb6e8d006415877bd6 Author: Richard Biener Date: Tue Jun 14 11:10:13 2022 +0200 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 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) Diff: --- gcc/tree-ssa-uninit.cc | 3 +++ 1 file changed, 3 insertions(+) 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;