diff options
author | Martin Sebor <msebor@redhat.com> | 2021-06-28 15:14:50 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2021-06-28 15:14:50 -0600 |
commit | 40c64c9ea565230817f08b5e66a30a1c94ec880c (patch) | |
tree | e459d7442ead2e4415959c4a4c873d8125a47b64 | |
parent | ed94172c7e174a9b56b9de066f4fb7e71c9ebaf9 (diff) | |
download | gcc-40c64c9ea565230817f08b5e66a30a1c94ec880c.zip gcc-40c64c9ea565230817f08b5e66a30a1c94ec880c.tar.gz gcc-40c64c9ea565230817f08b5e66a30a1c94ec880c.tar.bz2 |
Regression tests for TREE_NO_WARNING enhancement to warning groups [PR74765, PR74762].
PR middle-end/74765 - missing uninitialized warning (parenthesis, TREE_NO_WARNING abuse)
PR middle-end/74762 - [9/10/11/12 Regression] missing uninitialized warning (C++, parenthesized expr, TREE_NO_WARNING)
gcc/testsuite/ChangeLog:
* g++.dg/uninit-pr74762.C: New test.
* g++.dg/warn/uninit-pr74765.C: Same.
-rw-r--r-- | gcc/testsuite/g++.dg/uninit-pr74762.C | 24 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/uninit-pr74765.C | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/uninit-pr74762.C b/gcc/testsuite/g++.dg/uninit-pr74762.C new file mode 100644 index 0000000..ce1bc59 --- /dev/null +++ b/gcc/testsuite/g++.dg/uninit-pr74762.C @@ -0,0 +1,24 @@ +/* PR c++/74762 - missing uninitialized warning (C++, parenthesized expr) + { dg-do compile } + { dg-options "-Wall" } */ + +struct tree2; +struct tree_vector2 +{ + tree2 *elts[1]; +}; + +struct tree2 +{ + struct + { + tree_vector2 vector; + } u; +}; + +tree2 * +const_with_all_bytes_same (tree2 *val) +{ + int i; + return ((val->u.vector.elts[i])); // { dg-warning "\\\[-Wuninitialized" } +} diff --git a/gcc/testsuite/g++.dg/warn/uninit-pr74765.C b/gcc/testsuite/g++.dg/warn/uninit-pr74765.C new file mode 100644 index 0000000..1b8c124 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/uninit-pr74765.C @@ -0,0 +1,24 @@ +/* PR c++/74765 - missing uninitialized warning (parenthesis, + TREE_NO_WARNING abuse) + { dg-do compile } + { dg-options "-Wall" } */ + +int warn_equal_parens (int x, int y) +{ + int i; + + if ((i == 0)) // { dg-warning "\\\[-Wuninitialized" } + return x; + + return y; +} + +int warn_equal (int x, int y) +{ + int i; + + if (i == 0) // { dg-warning "\\\[-Wuninitialized" } + return x; + + return y; +} |