public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-2537] tree-optimization/106881 - constrain uninit control edge add
@ 2022-09-08 11:11 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-09-08 11:11 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c8d3b44dfa2851659f966627835497667c5fed6c
commit r13-2537-gc8d3b44dfa2851659f966627835497667c5fed6c
Author: Richard Biener <rguenther@suse.de>
Date: Thu Sep 8 12:22:26 2022 +0200
tree-optimization/106881 - constrain uninit control edge add
The following avoids adding fallthru edges to the control chain from
the post-dominator walk.
PR tree-optimization/106881
* gimple-predicate-analysis.cc (compute_control_dep_chain_pdom):
Add only non-fallthru edges and avoid the same set of edges
as the caller does.
* gcc.dg/uninit-pr106881.c: New testcase.
Diff:
---
gcc/gimple-predicate-analysis.cc | 9 ++++++---
gcc/testsuite/gcc.dg/uninit-pr106881.c | 16 ++++++++++++++++
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc
index f81af2589cd..910ab97a29e 100644
--- a/gcc/gimple-predicate-analysis.cc
+++ b/gcc/gimple-predicate-analysis.cc
@@ -1060,9 +1060,12 @@ compute_control_dep_chain_pdom (basic_block cd_bb, const_basic_block dep_bb,
gcc.dg/unninit-pred-12.c and PR106754. */
if (single_pred_p (cd_bb))
{
- edge e2 = find_edge (prev_cd_bb, cd_bb);
- gcc_assert (e2);
- cur_cd_chain.safe_push (e2);
+ edge e2 = single_pred_edge (cd_bb);
+ gcc_assert (e2->src == prev_cd_bb);
+ /* But avoid adding fallthru or abnormal edges. */
+ if (!(e2->flags & (EDGE_FAKE | EDGE_ABNORMAL | EDGE_DFS_BACK))
+ && !single_succ_p (prev_cd_bb))
+ cur_cd_chain.safe_push (e2);
}
}
return found_cd_chain;
diff --git a/gcc/testsuite/gcc.dg/uninit-pr106881.c b/gcc/testsuite/gcc.dg/uninit-pr106881.c
new file mode 100644
index 00000000000..343b13ed73d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr106881.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fexceptions -Wuninitialized" } */
+
+void l_free (void *);
+char *l_settings_get_string ();
+void eap_append_secret ();
+inline void auto_free(void *a) {
+ void **p = a;
+ l_free(*p); /* { dg-warning "uninitialized" } */
+}
+void eap_gtc_check_settings() {
+ char *identity __attribute__((cleanup(auto_free)));
+ char password __attribute__((cleanup(auto_free)));
+ identity = l_settings_get_string();
+ eap_append_secret();
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-08 11:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08 11:11 [gcc r13-2537] tree-optimization/106881 - constrain uninit control edge add 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).