* [PATCH] Add various testcases
@ 2017-10-10 20:23 Jakub Jelinek
2017-10-11 20:54 ` [PATCH] Add some further testcases Jakub Jelinek
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2017-10-10 20:23 UTC (permalink / raw)
To: gcc-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] Add some further testcases
2017-10-10 20:23 [PATCH] Add various testcases Jakub Jelinek
@ 2017-10-11 20:54 ` Jakub Jelinek
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2017-10-11 20:54 UTC (permalink / raw)
To: gcc-patches
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.
--- 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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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;
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-11 20:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10 20:23 [PATCH] Add various testcases Jakub Jelinek
2017-10-11 20:54 ` [PATCH] Add some further testcases Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).