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-5064] tree-optimization/101912 - testcase for fixed uninit case Date: Mon, 9 Jan 2023 11:19:09 +0000 (GMT) [thread overview] Message-ID: <20230109111909.2F9393858D20@sourceware.org> (raw) https://gcc.gnu.org/g:7afecddf1ecbb93ee44517ad6d3e9c1c0d68e722 commit r13-5064-g7afecddf1ecbb93ee44517ad6d3e9c1c0d68e722 Author: Richard Biener <rguenther@suse.de> Date: Mon Jan 9 11:00:43 2023 +0100 tree-optimization/101912 - testcase for fixed uninit case We now properly optimize this testcase and no longer diagnose a bogus uninit use. PR tree-optimization/101912 * gcc.dg/uninit-pr101912.c: New testcase. Diff: --- gcc/testsuite/gcc.dg/uninit-pr101912.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gcc/testsuite/gcc.dg/uninit-pr101912.c b/gcc/testsuite/gcc.dg/uninit-pr101912.c new file mode 100644 index 00000000000..1550c03436d --- /dev/null +++ b/gcc/testsuite/gcc.dg/uninit-pr101912.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ + +int getint (void); +int +tzloadbody (void) +{ + int n = getint (); + int prevcorr; + int leapcnt = 0; + for (int i = 0; i < n; i++) + { + int corr = getint (); + if (corr < 1 || (corr == 1 && !(leapcnt == 0 || (prevcorr < corr ? corr == prevcorr + 1 : (corr == prevcorr || corr == prevcorr - 1))))) /* { dg-bogus "uninitialized" } */ + return -1; + + prevcorr = corr; + leapcnt++; + } + return leapcnt; +}
reply other threads:[~2023-01-09 11:19 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=20230109111909.2F9393858D20@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).