OSDN Git Service

Testsuite changes for new -Wstrict-aliasing=2 option.
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Mar 2004 06:04:14 +0000 (06:04 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Mar 2004 06:04:14 +0000 (06:04 +0000)
* gcc.dg/alias-1.c: Add "will" to string passed to dg-warning.
* gcc.dg/alias-2.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79223 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 362aba8..31baa1d 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.
 2004-03-09  Zack Weinberg  <zack@codesourcery.com>
 
        * gcc.dg/noncompile/incomplete-2.c: Move dg-error to proper line.
index a723083..82dbc9e 100644 (file)
@@ -19,7 +19,7 @@ YYSTYPE
  addSibMacro(
          YYSTYPE  list )
  {
  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" "" }
      
  
      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;
+}