Testsuite changes for new -Wstrict-aliasing=2 option.

* gcc.dg/alias-1.c: Add "will" to string passed to dg-warning.
	* gcc.dg/alias-2.c: New testcase.

From-SVN: r79223
This commit is contained in:
James E Wilson 2004-03-10 06:04:14 +00:00 committed by Jim Wilson
parent 5399d64368
commit 8a308d45d5
3 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2004-03-09 James E Wilson <wilson@specifixinc.com>
* gcc.dg/alias-1.c: Add "will" to string passed to dg-warning.
* gcc.dg/alias-2.c: New testcase.
2004-03-09 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/noncompile/incomplete-2.c: Move dg-error to proper line.

View File

@ -19,7 +19,7 @@ YYSTYPE
addSibMacro(
YYSTYPE list )
{
tDefEntry** ppT = (tDefEntry**)&list; // { dg-warning "type-punned pointer" "" }
tDefEntry** ppT = (tDefEntry**)&list; // { dg-warning "type-punned pointer will" "" }
struct incomplete *p = (struct incomplete *)&list; // { dg-warning "type-punning to incomplete" "" }

View File

@ -0,0 +1,16 @@
// { dg-do compile }
// { dg-options "-Wstrict-aliasing=2 -fstrict-aliasing" }
struct foo {
char c;
char d;
short s;
int i;
} bar;
int
sub1 (long long int foobar)
{
struct foo *tmp = (struct foo *) &foobar; // { dg-warning "type-punned pointer might" "" }
return tmp->i;
}