Hello, The following patch is a testcase for PR93432,which deals with the warning for uninitialized variables.The testcase is for the bug already fixed.
Regtested on x86_64, OK for commit ? Please do review it. 2022-02-23 Krishna Narayanan <krishnanarayanan132...@gmail.com> PR c/93432 gcc/testsuite/Changelog: *gcc.dg/pr93432.c: New test --- gcc/testsuite/pr93432.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 gcc/testsuite/pr93432.c diff --git a/gcc/testsuite/pr93432.c b/gcc/testsuite/pr93432.c new file mode 100644 index 000000000..cd7199a56 --- /dev/null +++ b/gcc/testsuite/pr93432.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized -Wmaybe-uninitialized" } */ + int test(int y) { + int z; /* { dg-message "note: 'z' was declared here" } */ + int x; + int a; /* { dg-warning "'a' may be used uninitialized" } */ + for (x = 0; x < 10; x = x + 1, y = y + 1,a = a + 1) + { + if (y < 10) { + z = z + 1 + a; /* { dg-warning "'z' may be used uninitialized" } */ + } + } + return z; +} -- 2.25.1