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.
This commit is contained in:
Martin Sebor 2021-06-28 15:14:50 -06:00
parent ed94172c7e
commit 40c64c9ea5
2 changed files with 48 additions and 0 deletions

View file

@ -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" }
}

View file

@ -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;
}