]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorH.J. Lu <hongjiu.lu@intel.com>
Fri, 30 Jan 2009 17:31:24 +0000 (17:31 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Fri, 30 Jan 2009 17:31:24 +0000 (09:31 -0800)
2009-01-30  H.J. Lu  <hongjiu.lu@intel.com>

2009-01-27  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/38503
* g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C: New testcase.

2009-01-26  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/38745
* g++.dg/torture/pr38745.C: New testcase.

2009-01-26  Richard Guenther  <rguenther@suse.de>

PR middle-end/38851
* g++.dg/warn/Wuninitialized-1.C: New testcase.

2009-01-20  Andrew Pinski  <andrew_pinski@playstation.sony.com>
    Richard Guenther  <rguenther@suse.de>

PR tree-optimization/38747
PR tree-optimization/38748
* gcc.dg/tree-ssa/struct-aliasing-1.c: New test.
* gcc.c-torture/execute/struct-aliasing-1.c: Likewise.

From-SVN: r143798

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr38745.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wuninitialized-1.C [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c [new file with mode: 0644]

index 05c350719bc71e3c96159318e19d71bb28d735ae..e2c0572524b5f8d4fad5df64ca62fde887aa13b2 100644 (file)
@@ -1,3 +1,28 @@
+2009-01-30  H.J. Lu  <hongjiu.lu@intel.com>
+
+       2009-01-27  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/38503
+       * g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C: New testcase.
+
+       2009-01-26  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/38745
+       * g++.dg/torture/pr38745.C: New testcase.
+
+       2009-01-26  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/38851
+       * g++.dg/warn/Wuninitialized-1.C: New testcase.
+
+       2009-01-20  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+                   Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/38747
+       PR tree-optimization/38748
+       * gcc.dg/tree-ssa/struct-aliasing-1.c: New test.
+       * gcc.c-torture/execute/struct-aliasing-1.c: Likewise.
+
 2009-01-29  H.J. Lu  <hongjiu.lu@intel.com>
 
        2009-01-28  Richard Guenther  <rguenther@suse.de>
diff --git a/gcc/testsuite/g++.dg/torture/pr38745.C b/gcc/testsuite/g++.dg/torture/pr38745.C
new file mode 100644 (file)
index 0000000..4ad9d85
--- /dev/null
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+
+union u_u16
+{
+  unsigned short v;
+  struct
+    {
+      unsigned char lo8, hi8;
+    } __attribute__ ((__may_alias__)) u;
+} __attribute__ ((__may_alias__));
+union u_u32
+{
+  unsigned int v;
+  struct
+    {
+      u_u16 lo16, hi16;
+    } u;
+} __attribute__ ((__may_alias__));
+union u_u64
+{
+  struct
+    {
+      u_u32 lo32, hi32;
+    } u;
+};
+struct Record
+{
+};
+long long
+UnpackFullKey (Record & rec, const char *&p)
+{
+  long long c64 = 0;
+  (*(u_u16 *) & (*(u_u32 *) & ( *(u_u64*)&c64).u.lo32.v).u.lo16.v).u.hi8 = 1;
+  return c64;
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C
new file mode 100644 (file)
index 0000000..514957b
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wstrict-aliasing" } */
+
+inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }
+
+struct Y {
+  Y() {}
+  int i;
+};
+
+struct X {
+  X() {}
+  void construct(const Y& y)
+  {
+    new (&m_data[0]) Y(y);
+  }
+  bool initialized;
+  char m_data[sizeof (Y)];
+};
+
+void bar(const X&);
+void foo(Y& y)
+{
+  X x;
+  x.construct(y);
+  x.initialized = true;
+  bar(x);
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/Wuninitialized-1.C b/gcc/testsuite/g++.dg/warn/Wuninitialized-1.C
new file mode 100644 (file)
index 0000000..7b1b90b
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-options "-O2 -Wuninitialized" } */
+
+struct Empty { Empty() {} }; /* { dg-bogus "uninitialized" } */
+struct Other {
+    Other(const Empty& e_) : e(e_) {}
+    Empty e;
+};
+void bar(Other&);
+void foo()
+{
+  Empty e;
+  Other o(e);
+  bar(o);
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c b/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c
new file mode 100644 (file)
index 0000000..9786b44
--- /dev/null
@@ -0,0 +1,17 @@
+struct S { float f; };
+int __attribute__((noinline))
+foo (int *r, struct S *p)
+{
+  int *q = (int *)&p->f;
+  int i = *q;
+  *r = 0;
+  return i + *q;
+}
+extern void abort (void);
+int main()
+{
+  int i = 1;
+  if (foo (&i, (struct S *)&i) != 1)
+    abort ();
+  return (0);
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c b/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
new file mode 100644 (file)
index 0000000..78e92d7
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do "compile" } */
+/* { dg-options "-O2 -fdump-tree-fre" } */
+
+struct S { float f; };
+int __attribute__((noinline))
+foo (float *r, struct S *p)
+{
+  int *q = (int *)&p->f;
+  int i = *q;
+  *r = 0.0;
+  return i + *q;
+}
+
+/* { dg-final { scan-tree-dump-times "\\\*q" 1 "fre" } } */
+/* { dg-final { cleanup-tree-dump "fre" } } */