diff options
-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; +} |