From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122011 invoked by alias); 9 Dec 2016 19:32:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 120995 invoked by uid 89); 9 Dec 2016 19:32:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=motivation 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; Fri, 09 Dec 2016 19:32:29 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 791B264D89 for ; Fri, 9 Dec 2016 19:32:28 +0000 (UTC) Received: from vpn-229-196.phx2.redhat.com (vpn-229-196.phx2.redhat.com [10.3.229.196]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB9JWRrI016579; Fri, 9 Dec 2016 14:32:27 -0500 Message-ID: <1481311947.16607.47.camel@redhat.com> Subject: PR target/78213 revisited (was Re: [PATCH 5/9] Introduce selftest::locate_file (v4)) From: David Malcolm To: Bernd Schmidt , gcc-patches@gcc.gnu.org Cc: aldyh@redhat.com Date: Fri, 09 Dec 2016 19:32:00 -0000 In-Reply-To: References: <1478898935-46932-1-git-send-email-dmalcolm@redhat.com> <1478898935-46932-6-git-send-email-dmalcolm@redhat.com> <6c5f9feb-8cc3-a7e1-b102-4ac9bcd54e0b@redhat.com> <1481233659.16607.10.camel@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00914.txt.bz2 On Fri, 2016-12-09 at 02:48 +0100, Bernd Schmidt wrote: > On 12/08/2016 10:47 PM, David Malcolm wrote: > > > Is (A) OK, or would you prefer (B)? (I prefer (A) fwiw) > > Oh well, just keep it as it is. > > > Bernd Thanks. Unfortunately, applying the "locate_file" patch https://gcc.gnu.org/ml/gcc-patches/2016-11/msg01186.html would now introduce a regression in a recently-added test case: Tests changing outcome in gcc/testsuite/gcc/gcc.sum: 2 ------------------------------------------------------ PASS -> FAIL : gcc.dg/pr78213.c (test for excess errors) PASS -> FAIL : gcc.dg/pr78213.c -fself-test (test for warnings, line ) This test case was added in r242748 (aka 7c889936fe48e15a57b6d1509197a1492d49b0fb) by aldy (CCed) to fix PR target/78213: commit 7c889936fe48e15a57b6d1509197a1492d49b0fb Author: aldyh Date: Wed Nov 23 12:18:23 2016 +0000 PR target/78213 * opts.c (finish_options): Set -fsyntax-only if running self tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242748 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 192d6e4..ec1fe96 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-11-23 Aldy Hernandez + + PR target/78213 + * opts.c (finish_options): Set -fsyntax-only if running self + tests. + 2016-11-23 Richard Biener PR middle-end/71762 diff --git a/gcc/opts.c b/gcc/opts.c index d2d6100..cb20154 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -744,6 +744,14 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, opts->x_flag_toplevel_reorder = 0; } + /* -fself-test depends on the state of the compiler prior to + compiling anything. Ideally it should be run on an empty source + file. However, in case we get run with actual source, assume + -fsyntax-only which will inhibit any compiler initialization + which may confuse the self tests. */ + if (opts->x_flag_self_test) + opts->x_flag_syntax_only = 1; + if (opts->x_flag_tm && opts->x_flag_non_call_exceptions) sorry ("transactional memory is not supported with non-call exceptions"); diff --git a/gcc/testsuite/gcc.dg/pr78213.c b/gcc/testsuite/gcc.dg/pr78213.c new file mode 100644 index 0000000..e43c83c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr78213.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-fself-test" } */ + +/* Verify that -fself-test does not fail on a non empty source. */ + +int i; void bar(); +{ + while (i--) + bar(); +} +/* { dg-message "fself\-test: " "-fself-test" { target *-*-* } 0 } */ The problem is that this DejaGnu test case uses -fself-test, and doesn't provide any arguments. With the locate_file patch, we need to pass the path to $(srcdir)/testsuite/selftests as an argument to -fself -test, and it's not clear to me how to do that sanely in a DejaGnu test case; if I pass in a dummy value (like for pr71591.c), then the selftests that use locate_file fail. (fwiw I'm not particularly fond of us running the selftests a second time from within DejaGnu, or for that matter, of supporting non-empty source files in the selftests; my preferred fix for this is to delete gcc/testsuite/gcc.dg/pr78213.c). The motivation for the patch is to be able to verify that the RTL function parser code works properly, by having selftests that read RTL function dumps, and asserting various properties of the in-memory representation. Doing this means we need some way to locate the dumpfiles from within the selftests, hence selftest::locate_file. Thoughts? Dave