public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5064] tree-optimization/101912 - testcase for fixed uninit case
@ 2023-01-09 11:19 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-01-09 11:19 UTC (permalink / raw)
To: gcc-cvs
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;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-09 11:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 11:19 [gcc r13-5064] tree-optimization/101912 - testcase for fixed uninit case 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).