From patchwork Wed Oct 11 20:52:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 824566 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-463977-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="fSzguvSt"; 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 3yC5lk6Nnnz9sPr for ; Thu, 12 Oct 2017 07:52:48 +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:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=VfBMoMNkzlaqjBHFl Q+SkL/f5nhn0rLvf0Fx6rA1KXSOyVLw63hmXUOKu2zj/byqgdQtWzA7XVK2bazZh o46woE53Ih8vKKaH66BsWIfvKpN3WP75dsbT4X+LXlUBZPSN7JYVfcfw0FKsz5aM aogXTNNeZgM/dzNvV8v2QLNfjc= 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:references:mime-version :content-type:in-reply-to; s=default; bh=OfHROaZx+8rE5cQyUQfIZF0 C5ZU=; b=fSzguvStM8SxEthMe3guWH4iGn+DkF+t5TSHmalPxdHNlQVsxr2Q9jx /9AO25WAbJsazojZblHSOVTUtTM3jR6LEB/8OYVhKG6sjXdq8ajDorwXedK1s0vd h4/hK9thHItZAA4hu4Vpq8YN9cvqbDYLTNcuOOORWuwuEC76iurI= Received: (qmail 38019 invoked by alias); 11 Oct 2017 20:52:33 -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 38006 invoked by uid 89); 11 Oct 2017 20:52:33 -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=fn1, Hx-languages-length:5616, fn2 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; Wed, 11 Oct 2017 20:52:31 +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 A7CFD68B5 for ; Wed, 11 Oct 2017 20:52:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A7CFD68B5 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.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 5121917C3E for ; Wed, 11 Oct 2017 20:52:30 +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 v9BKqRf0024367 for ; Wed, 11 Oct 2017 22:52:28 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v9BKqRMO024366 for gcc-patches@gcc.gnu.org; Wed, 11 Oct 2017 22:52:27 +0200 Date: Wed, 11 Oct 2017 22:52:27 +0200 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Add some further testcases Message-ID: <20171011205227.GM14653@tucnak> Reply-To: Jakub Jelinek References: <20171010202122.GF14653@tucnak> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171010202122.GF14653@tucnak> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes 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 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 --- 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 +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; +}