public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/105946 - avoid accessing excess args from uninit diag
@ 2022-06-14 10:49 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-06-14 10:49 UTC (permalink / raw)
  To: gcc-patches

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.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

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 | 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;
 
-- 
2.35.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] tree-optimization/105946 - avoid accessing excess args from uninit diag
@ 2022-06-14 10:49 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-06-14 10:49 UTC (permalink / raw)
  To: gcc-patches

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.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

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 | 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;
 
-- 
2.35.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] tree-optimization/105946 - avoid accessing excess args from uninit diag
@ 2022-06-14 10:49 Richard Biener
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2022-06-14 10:49 UTC (permalink / raw)
  To: gcc-patches

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.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

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 | 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;
 
-- 
2.35.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-14 10:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 10:49 [PATCH] tree-optimization/105946 - avoid accessing excess args from uninit diag Richard Biener
2022-06-14 10:49 Richard Biener
2022-06-14 10:49 Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).