public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2537] tree-optimization/106881 - constrain uninit control edge add Date: Thu, 8 Sep 2022 11:11:43 +0000 (GMT) [thread overview] Message-ID: <20220908111143.851B93858D28@sourceware.org> (raw) 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(); +}
reply other threads:[~2022-09-08 11:11 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220908111143.851B93858D28@sourceware.org \ --to=rguenth@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).