This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Add various testcases


Hi!

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. 

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

	PR c++/68252
	* g++.dg/other/pr68252.C: New test.

	PR middle-end/70100
	* g++.dg/opt/pr70100.C: New test.

	PR c++/77578
	* g++.dg/gomp/pr77578.C: New test.

	PR c++/71875
	* g++.dg/cpp1y/pr71875.C: New test.

	PR c++/77786
	* g++.dg/cpp1y/pr77786.C: New test.

	PR c++/70338
	* g++.dg/cpp0x/pr70338.C: New test.

	PR middle-end/70887
	* g++.dg/cpp0x/pr70887.C: New test.

	PR c++/67625
	* g++.dg/cpp0x/pr67625.C: New test.

	PR rtl-optimization/68205
	* gcc.c-torture/execute/20040709-3.c: New test.

--- gcc/testsuite/g++.dg/other/pr68252.C.jj	2017-10-10 16:14:47.735994894 +0200
+++ gcc/testsuite/g++.dg/other/pr68252.C	2017-10-10 16:14:41.433072970 +0200
@@ -0,0 +1,5 @@
+// PR c++/68252
+
+struct Test {
+  static const int foo = (1 << sizeof (int)) * -3;
+};
--- gcc/testsuite/g++.dg/opt/pr70100.C.jj	2017-10-10 16:37:07.809387447 +0200
+++ gcc/testsuite/g++.dg/opt/pr70100.C	2017-10-10 16:37:03.425441796 +0200
@@ -0,0 +1,21 @@
+// PR middle-end/70100
+// { dg-do compile { target c++11 } }
+// { dg-options "-O0" }
+
+void
+bar (int)
+{
+}
+
+template <typename ... Args>
+void
+foo (Args && ... args)
+{
+  [&] { [&] { bar(args...); }; };
+}
+
+int
+main ()
+{
+  foo (2);
+}
--- gcc/testsuite/g++.dg/gomp/pr77578.C.jj	2017-10-10 17:57:44.029443215 +0200
+++ gcc/testsuite/g++.dg/gomp/pr77578.C	2017-10-10 18:02:03.459239650 +0200
@@ -0,0 +1,31 @@
+// PR c++/77578
+// { dg-do compile }
+
+template <typename T>
+class A 
+{
+};
+
+template <typename T>
+struct B
+{
+};
+
+template <typename T>
+struct B <A <T> >
+{
+  typedef A <T> C;
+  typedef typename C::D D;
+ 
+  template <typename U>
+  static void
+  foo (const D x, const D y)
+  {
+    U u;
+    {
+      #pragma omp parallel for 
+      for (u.bar().y() = x.y(); u.bar().y() <= y.y(); u.bar().y()++) // { dg-error "expected" }
+	;
+    }
+  }
+};
--- gcc/testsuite/g++.dg/cpp1y/pr71875.C.jj	2017-10-10 17:50:04.473120255 +0200
+++ gcc/testsuite/g++.dg/cpp1y/pr71875.C	2017-10-10 17:50:48.204578368 +0200
@@ -0,0 +1,24 @@
+// PR c++/71875
+// { dg-do link { target c++14 } }
+
+template <typename T>
+constexpr bool IsMatrix = false;
+
+template<typename TElem>
+class Matrix {};
+
+template <typename TElem>
+constexpr bool IsMatrix<Matrix<TElem>> = true;
+
+template<typename TNestVec>
+class RowVecExpMatrix;
+
+template <typename TNestVec>
+constexpr bool IsMatrix<RowVecExpMatrix<TNestVec>> = true;
+
+int
+main ()
+{
+  static_assert (IsMatrix<RowVecExpMatrix<Matrix<int>>>, "Matrix check error");
+  static_assert (IsMatrix<Matrix<int>>, "Input type is not a matrix");
+}
--- gcc/testsuite/g++.dg/cpp1y/pr77786.C.jj	2017-10-10 18:06:07.985220123 +0200
+++ gcc/testsuite/g++.dg/cpp1y/pr77786.C	2017-10-10 18:06:26.489991618 +0200
@@ -0,0 +1,21 @@
+// PR c++/77786
+// { dg-do compile { target c++14 } }
+
+#include <vector>
+
+template<int N>
+void
+foo (std::vector<int> a)
+{
+  auto const a_size = a.size();
+  auto bar = [&](auto y) -> void { int a_size_2 = a_size; };
+  double x = 0.0;
+  bar (x);
+}
+
+int
+main ()
+{
+  std::vector<int> a(1);
+  foo<1>(a);
+}
--- gcc/testsuite/g++.dg/cpp0x/pr70338.C.jj	2017-10-10 17:04:04.641335439 +0200
+++ gcc/testsuite/g++.dg/cpp0x/pr70338.C	2017-10-10 17:03:49.000000000 +0200
@@ -0,0 +1,17 @@
+// PR c++/70338
+// { dg-do compile { target c++11 } }
+// { dg-options "-g" }
+
+template<typename T>
+void
+foo (int x)
+{
+  T a[x];
+  auto b = [&]() { for (auto &c: a) c = 0.; };
+}
+
+int
+main ()
+{
+  foo<double> (3);
+}
--- gcc/testsuite/g++.dg/cpp0x/pr70887.C.jj	2017-10-10 17:30:11.667902426 +0200
+++ gcc/testsuite/g++.dg/cpp0x/pr70887.C	2017-10-10 17:30:03.433004543 +0200
@@ -0,0 +1,31 @@
+// PR middle-end/70887
+// { dg-do compile { target { { i?86-*-* x86_64-*-* } && c++11 } } }
+// { dg-options "-O2 -msse2" }
+
+#include <x86intrin.h>
+
+enum R { S };
+template <R> struct C { static constexpr int value = 10; };
+template <typename R, template <R> class T, R... r>
+struct A {
+  template <int, R...> struct B;
+  template <int N, R M, R... O>
+  struct B<N, M, O...> {
+    static constexpr int d = T<M>::value;
+    static __m128i generate()
+    {
+      __attribute__((__vector_size__(16))) long long
+      a = generate(),
+      b = _mm_bslli_si128 (a, 1),
+      c = _mm_bsrli_si128 (_mm_set1_epi32(d), 12);
+      return _mm_or_si128 (b, c);
+    }
+  };
+  A () { B<0, r...>::generate(); }
+};
+
+int
+main () {
+  using RI = A<R, C, S>;
+  RI ri;
+}
--- gcc/testsuite/g++.dg/cpp0x/pr67625.C.jj	2017-10-10 15:55:53.677013155 +0200
+++ gcc/testsuite/g++.dg/cpp0x/pr67625.C	2017-10-10 15:55:27.902331316 +0200
@@ -0,0 +1,12 @@
+// PR c++/67625
+// { dg-do compile { target c++11 } }
+
+constexpr unsigned short
+bswap16 (unsigned short x)
+{
+  return __builtin_bswap16 (x);
+}
+constexpr int a = bswap16 (1);
+enum { b = a };
+enum { c = __builtin_bswap16 (1) };
+enum { d = bswap16 (1) };
--- gcc/testsuite/gcc.c-torture/execute/20040709-3.c.jj	2017-10-10 16:04:28.567657384 +0200
+++ gcc/testsuite/gcc.c-torture/execute/20040709-3.c	2017-10-10 16:05:09.648150289 +0200
@@ -0,0 +1,5 @@
+/* PR rtl-optimization/68205 */
+/* { dg-require-effective-target int32plus } */
+/* { dg-additional-options "-fno-common" } */
+
+#include "20040709-2.c"

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]