Testsuite changes for new -Wstrict-aliasing=2 option.
authorJames E Wilson <wilson@specifixinc.com>
Wed, 10 Mar 2004 06:04:14 +0000 (06:04 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Wed, 10 Mar 2004 06:04:14 +0000 (22:04 -0800)
* gcc.dg/alias-1.c: Add "will" to string passed to dg-warning.
* gcc.dg/alias-2.c: New testcase.

From-SVN: r79223

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/alias-1.c
gcc/testsuite/gcc.dg/alias-2.c [new file with mode: 0644]

index 362aba8bbc9fdedc26b04d6ad10afca7476e7018..31baa1d1c433a537f9948068e69373548321d677 100644 (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.
index a723083672cecd22d1d1c6c4b2f8f433c2f6442b..82dbc9efbf843c8d45d4fe5adb529d9fdc69670d 100644 (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" "" }
      
diff --git a/gcc/testsuite/gcc.dg/alias-2.c b/gcc/testsuite/gcc.dg/alias-2.c
new file mode 100644 (file)
index 0000000..d507416
--- /dev/null
@@ -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;
+}