From patchwork Tue Oct 10 20:21:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 824046 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-463895-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="orjSD1QA"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yBT6C2Wq9z9t5Q for ; Wed, 11 Oct 2017 07:21:37 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=gfmealeC8UWMsaX0nwtQEn3RuHaglMUwDrtYbjMvIoU QJtMEG7UKo5IlBI7/zOACugYAC9CPYXIv4uKzmjwTZFwn3RfM3oo4MvIrk1Alz/l g7DVyOm+5Caqewk3dglew9C8Z/V5ikVYQMlM0GXLEYr+yFVfDCnZsPd9mMGeY+LQ = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=63hja0N8XIjCIqm63IRliQ2v4fo=; b=orjSD1QA3L8aNQTPt ZNF78j8jTlaNj9wlGb2yutA9+RZ8wDr/rBGLR9+Gq5rOWvccbWWtNEIiui98RhNY uLkyCBmJVHTuIm+8QMq1JQH2Lgyl8WJIG91rmn0eHx1eCUW8Xn7fOs8VBlYAPEtI qVWvGzI4g4H/NJ6h69dQahsG3s= Received: (qmail 63128 invoked by alias); 10 Oct 2017 20:21:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 63115 invoked by uid 89); 10 Oct 2017 20:21:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=prs, yy X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Oct 2017 20:21:28 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A520820E3 for ; Tue, 10 Oct 2017 20:21:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1A520820E3 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub@redhat.com Received: from tucnak.zalov.cz (ovpn-116-223.ams2.redhat.com [10.36.116.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B643817C48 for ; Tue, 10 Oct 2017 20:21:25 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v9AKLNwI026606 for ; Tue, 10 Oct 2017 22:21:23 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v9AKLMg4026605 for gcc-patches@gcc.gnu.org; Tue, 10 Oct 2017 22:21:22 +0200 Date: Tue, 10 Oct 2017 22:21:22 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Add various testcases Message-ID: <20171010202122.GF14653@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes 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 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. Jakub --- 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 +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 +class A +{ +}; + +template +struct B +{ +}; + +template +struct B > +{ + typedef A C; + typedef typename C::D D; + + template + 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 +constexpr bool IsMatrix = false; + +template +class Matrix {}; + +template +constexpr bool IsMatrix> = true; + +template +class RowVecExpMatrix; + +template +constexpr bool IsMatrix> = true; + +int +main () +{ + static_assert (IsMatrix>>, "Matrix check error"); + static_assert (IsMatrix>, "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 + +template +void +foo (std::vector 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 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 +void +foo (int x) +{ + T a[x]; + auto b = [&]() { for (auto &c: a) c = 0.; }; +} + +int +main () +{ + foo (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 + +enum R { S }; +template struct C { static constexpr int value = 10; }; +template class T, R... r> +struct A { + template struct B; + template + struct B { + static constexpr int d = T::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; + 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"