aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-01-09 11:00:43 +0100
committerRichard Biener <rguenther@suse.de>2023-01-09 12:18:54 +0100
commit7afecddf1ecbb93ee44517ad6d3e9c1c0d68e722 (patch)
tree5d6ab223a554646d27125625a829686c92f7226a
parentbefd29d5fe15c09638f73eeeb1f8a9e62ce569ee (diff)
downloadgcc-7afecddf1ecbb93ee44517ad6d3e9c1c0d68e722.zip
gcc-7afecddf1ecbb93ee44517ad6d3e9c1c0d68e722.tar.gz
gcc-7afecddf1ecbb93ee44517ad6d3e9c1c0d68e722.tar.bz2
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.
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr101912.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/uninit-pr101912.c b/gcc/testsuite/gcc.dg/uninit-pr101912.c
new file mode 100644
index 0000000..1550c03
--- /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;
+}