Add some further testcases

Message ID 20171011205227.GM14653@tucnak
State New
Headers show
Series
  • Add some further testcases
Related show

Commit Message

Jakub Jelinek Oct. 11, 2017, 8:52 p.m.
On Tue, Oct 10, 2017 at 10:21:22PM +0200, Jakub Jelinek wrote:
> While going through still open [5 Regression] bugs manually, I've gathered
> various testcases from PRs that were fixed by other changes and thus
> IMHO the tests are worth being added.  I have some further PRs to go through
> tomorrow, so I might add some further ones.
> 
> Regtested on x86_64-linux and i686-linux, committed to trunk. 

So, here is the remainder from 5 branch closing, regtested on x86_64-linux
and i686-linux, committed to trunk:

2017-10-11  Jakub Jelinek  <jakub@redhat.com>

	PR c++/80194
	* g++.dg/cpp1y/pr80194.C: New test.

	PR c++/78523
	* g++.dg/cpp1y/pr78523.C: New test.

	PR c++/82414
	* g++.dg/lto/pr82414_0.C: New test.

	PR tree-optimization/78558
	* gcc.dg/vect/pr78558.c: New test.

	PR middle-end/80421
	* gcc.c-torture/execute/pr80421.c: New test.



	Jakub

Patch

--- gcc/testsuite/g++.dg/cpp1y/pr80194.C.jj	2017-10-11 11:24:28.294661793 +0200
+++ gcc/testsuite/g++.dg/cpp1y/pr80194.C	2017-10-11 11:24:21.039750326 +0200
@@ -0,0 +1,17 @@ 
+// PR c++/80194
+// { dg-do compile { target c++14 } }
+
+int fn1 ();
+
+template <class Fn>
+void
+fn2 (Fn &&fn)
+{
+  fn (42);
+}
+
+void fn2 ()
+{
+  auto const x = fn1 ();
+  fn2 ([&](auto) { x; });
+}
--- gcc/testsuite/g++.dg/cpp1y/pr78523.C.jj	2017-10-11 10:51:51.608551082 +0200
+++ gcc/testsuite/g++.dg/cpp1y/pr78523.C	2017-10-11 10:51:43.175654055 +0200
@@ -0,0 +1,12 @@ 
+// PR c++/78523
+// { dg-do compile { target c++14 } }
+
+int bar ();
+
+void
+foo ()
+{
+  const int t = bar ();
+  auto f = [=] (auto x) { return t; };
+  f (0);
+}
--- gcc/testsuite/g++.dg/lto/pr82414_0.C.jj	2017-10-11 11:56:56.000000000 +0200
+++ gcc/testsuite/g++.dg/lto/pr82414_0.C	2017-10-11 11:59:16.000000000 +0200
@@ -0,0 +1,13 @@ 
+// PR c++/82414
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -g } } }
+
+typedef __attribute__ ((__aligned__ (16))) struct S { __extension__ unsigned long long Part[2]; } T; // bogus warning "violates one definition rule"
+
+int
+main ()
+{
+  T tf;
+  asm volatile ("" : : "g" (__alignof__(tf)), "g" (__alignof__ (struct S)), "g" (__alignof__ (T)));
+  return 0;
+}
--- gcc/testsuite/gcc.dg/vect/pr78558.c.jj	2017-10-11 11:04:59.940924884 +0200
+++ gcc/testsuite/gcc.dg/vect/pr78558.c	2017-10-11 11:06:20.584940340 +0200
@@ -0,0 +1,44 @@ 
+/* PR tree-optimization/78558 */
+
+#include "tree-vect.h"
+
+struct S
+{
+  char p[48];
+  unsigned long long q, r, s;
+} s[50];
+
+struct D
+{
+  unsigned long long q, r;
+} d[50];
+
+void
+foo (void)
+{
+  unsigned long i;
+  for (i = 0; i < 50; ++i)
+    {
+      d[i].q = s[i].q;
+      d[i].r = s[i].r;
+    }
+}
+
+int
+main ()
+{
+  check_vect ();
+  unsigned long i;
+  for (i = 0; i < 50; ++i)
+    {
+      s[i].q = i;
+      s[i].r = 50 * i;
+    }
+  asm volatile ("" : : "g" (s), "g" (d) : "memory");
+  foo ();
+  asm volatile ("" : : "g" (s), "g" (d) : "memory");
+  for (i = 0; i < 50; ++i)
+    if (d[i].q != i || d[i].r != 50 * i)
+      abort ();
+  return 0;
+}
--- gcc/testsuite/gcc.c-torture/execute/pr80421.c.jj	2017-10-11 11:36:45.070670843 +0200
+++ gcc/testsuite/gcc.c-torture/execute/pr80421.c	2017-10-11 11:41:29.670198693 +0200
@@ -0,0 +1,121 @@ 
+/* PR middle-end/80421 */
+
+__attribute__ ((noinline, noclone)) void
+baz (const char *t, ...)
+{
+  asm volatile (""::"r" (t):"memory");
+  if (*t == 'T')
+    __builtin_abort ();
+}
+
+unsigned int
+foo (char x)
+{
+  baz ("x %c\n", x);
+  switch (x)
+    {
+    default:
+      baz ("case default\n");
+      if (x == 'D' || x == 'I')
+	baz ("This should never be reached.\n");
+      return 0;
+    case 'D':
+      baz ("case 'D'\n");
+      return 0;
+    case 'I':
+      baz ("case 'I'\n");
+      return 0;
+    }
+}
+
+void
+bar (void)
+{
+  int a = 2;
+  int b = 5;
+  char c[] = {
+    2, 4, 1, 2, 5, 5, 2, 4, 4, 0, 0, 0, 0, 0, 0, 3, 4, 4, 2, 4,
+    1, 2, 5, 5, 2, 4, 1, 0, 0, 0, 2, 4, 4, 3, 4, 3, 3, 5, 1, 3,
+    5, 5, 2, 4, 4, 2, 4, 1, 3, 5, 3, 3, 5, 1, 3, 5, 1, 2, 4, 4,
+    2, 4, 2, 3, 5, 1, 3, 5, 1, 3, 5, 5, 2, 4, 1, 2, 4, 2, 3, 5,
+    3, 3, 5, 1, 3, 5, 5, 2, 4, 1, 2, 4, 1, 3, 5, 3, 3, 5, 1, 3,
+    5, 5, 2, 4, 4, 2, 4, 1, 3, 5, 3, 3, 5, 1, 3, 5, 1, 2, 4, 1,
+    2, 4, 2, 3, 5, 1, 3, 5, 1, 3, 5, 1, 2, 4, 1, 2, 4, 1, 3, 5,
+    1, 3, 5, 1, 3, 5, 1, 2, 4, 4, 2, 4, 1, 3, 5, 1, 3, 5, 1, 3,
+    5, 5, 2, 4, 4, 2, 4, 2, 3, 5, 3, 3, 5, 1, 3, 5, 5, 2, 4, 4,
+    2, 4, 1, 3, 5, 3, 3, 5, 1, 3, 5, 1, 2, 5, 5, 2, 4, 2, 3, 5,
+    1, 3, 4, 1, 3, 5, 1, 2, 5, 5, 2, 4, 1, 2, 5, 1, 3, 5, 3, 3,
+    5, 1, 2, 5, 5, 2, 4, 2, 2, 5, 1, 3, 5, 3, 3, 5, 1, 2, 5, 1,
+    2, 4, 1, 2, 5, 2, 3, 5, 1, 3, 5, 1, 2, 5, 1, 2, 4, 2, 2, 5,
+    1, 3, 5, 1, 3, 5, 1, 2, 5, 5, 2, 4, 2, 2, 5, 2, 3, 5, 3, 3,
+    5, 1, 2, 5, 5, 2, 4, 2, 2, 5, 2, 3, 5, 3, 3, 5, 1, 2, 5, 5,
+    2, 4, 2, 2, 5, 1, 3, 5, 3, 3, 5, 1, 2, 5, 5, 2, 4, 2, 2, 5,
+    1, 3, 5, 3, 3, 5, 1, 2, 5, 1, 2, 4, 1, 2, 5, 2, 3, 5, 1, 3,
+    5, 1, 2, 5, 5, 2, 4, 2, 2, 5, 2, 3, 5, 3, 3, 5, 1, 2, 5, 5,
+    2, 4, 1, 2, 5, 1, 3, 5, 3, 3, 5, 1, 2, 5, 5, 2, 4, 2, 2, 5,
+    1, 3, 5, 3, 3, 5, 1, 2, 5, 5, 2, 4, 2, 2, 5, 1, 3, 5, 3, 3,
+    5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+  };
+  char *f = c + 390;
+  int i, j, e, g, h;
+  char k, l;
+  i = 26;
+  j = 25;
+  k = l = 'M';
+  h = 2;
+  while (i > 0)
+    {
+      int x = i - a;
+      x = x > 0 ? x : 0;
+      x = j - x;
+      g = x * 3 + h;
+      switch (f[g])
+	{
+	case 1:
+	  --i;
+	  --j;
+	  h = 2;
+	  f -= b * 3;
+	  k = 'M';
+	  break;
+	case 2:
+	  --i;
+	  h = 0;
+	  f -= b * 3;
+	  k = 'I';
+	  break;
+	case 3:
+	  --i;
+	  h = 2;
+	  f -= b * 3;
+	  k = 'I';
+	  break;
+	case 4:
+	  --j;
+	  h = 1;
+	  k = 'D';
+	  break;
+	case 5:
+	  --j;
+	  h = 2;
+	  k = 'D';
+	  break;
+	}
+      if (k == l)
+	++e;
+      else
+	{
+	  foo (l);
+	  l = k;
+	}
+    }
+}
+
+int
+main ()
+{
+  char l = 'D';
+  foo (l);
+  bar ();
+  return 0;
+}