From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 447833857BA4 for ; Thu, 15 Jun 2023 16:04:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 447833857BA4 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="6.00,245,1681200000"; d="scan'208,223";a="9963949" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 15 Jun 2023 08:04:09 -0800 IronPort-SDR: vCd8LvDY+UFlgvH/cfz2QvuZccyb0+TfglFEMFuqO98mnEXOxUQUScSmvsf8kO2xmWtAyMd2DQ skXqER/kkA73CZNtZhHn6QSD4IR00RyC3Mt6RTFdUIzWLPJfKtM8skyF1HnsJbOMuJfVaeDikr O8PpDfYOMYvtwRm+Lkg5qfcL65X8FwTn2UkbDtD72HFPz9LFxvSJkkUMsOri/WeOM7EsMMVTEQ ISWZyFyfGm45SYG89NXtqwBQ0p5wspuRsCCF59yyLomsfJRkC/oQ2TwXxqj6wmpR1fOqj2P6S1 ofU= From: Thomas Schwinge To: , Jason Merrill , "Nathan Sidwell" CC: Jonathan Wakely Subject: Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) test suites for '-fno-exceptions')) In-Reply-To: <87wn04eoyd.fsf@euler.schwinge.homeip.net> References: <873534qu9e.fsf@euler.schwinge.homeip.net> <87wn04eoyd.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Thu, 15 Jun 2023 18:04:04 +0200 Message-ID: <87r0qcemq3.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi! On 2023-06-15T17:15:54+0200, I wrote: > On 2023-06-06T20:31:21+0100, Jonathan Wakely wrote: >> On Tue, 6 Jun 2023 at 20:14, Thomas Schwinge w= rote: >>> This issue comes up in context of me working on C++ support for GCN and >>> nvptx target. Those targets shall default to '-fno-exceptions' -- or, >>> "in other words", '-fexceptions' is not supported. (Details omitted >>> here.) >>> >>> It did seem clear to me that with such a configuration it'll be hard to >>> get clean test results. Then I found code in >>> 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune': >>> >>> # If exceptions are disabled, mark tests expecting exceptions to be= enabled >>> # as unsupported. >>> if { ![check_effective_target_exceptions_enabled] } { >>> if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled"= $text] { >>> return "::unsupported::exception handling disabled" >>> } >>> >>> ..., which, in a way, sounds as if the test suite generally is meant to >>> produce useful results for '-fno-exceptions', nice surprise! >>> >>> Running x86_64-pc-linux-gnu (not yet GCN, nvptx) 'make check' with: >>> >>> RUNTESTFLAGS=3D'--target_board=3Dunix/-fno-exceptions\{,-m32\}' >>> >>> ..., I find that indeed this does work for a lot of test cases, where w= e >>> then get (random example): >>> >>> PASS: g++.dg/coroutines/pr99710.C (test for errors, line 23) >>> -PASS: g++.dg/coroutines/pr99710.C (test for excess errors) >>> +UNSUPPORTED: g++.dg/coroutines/pr99710.C: exception handling disab= led >>> >>> ..., due to: >>> >>> [...]/g++.dg/coroutines/pr99710.C: In function 'task my_coro()': >>> +[...]/g++.dg/coroutines/pr99710.C:18:10: error: exception handling >>> disabled, use '-fexceptions' to enable >>> [...]/g++.dg/coroutines/pr99710.C:23:7: error: await expressions a= re >>> not permitted in handlers >>> compiler exited with status 1 >>> >>> But, we're nowhere near clean test results: PASS -> FAIL as well as >>> XFAIL -> XPASS regressions, due to 'error: exception handling disabled' >>> precluding other diagnostics seems to be one major issue. >>> >>> Is there interest in me producing the obvious (?) changes to those test >>> cases, such that compiler g++ as well as target library libstdc++ test >>> results are reasonably clean? (If you think that's all "wasted effort"= , >>> then I suppose I'll just locally ignore any FAILs/XPASSes/UNRESOLVEDs >>> that appear in combination with >>> 'UNSUPPORTED: [...]: exception handling disabled'.) >> >> I would welcome that for libstdc++. [...] > Not having heard anything contrary regarding the compiler side of things, > I've now been working on that, see below. >>> Otherwise, a number of test cases need DejaGnu directives >>> conditionalized on 'target exceptions_enabled'. > > Before I get to such things, even simpler: OK to push the attached > "Skip a number of C++ test cases for '-fno-exceptions' testing"? Similarly, OK to push the attached "Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' = testing"? Gr=C3=BC=C3=9Fe Thomas >>> (Or, >>> 'error: exception handling disabled' made a "really late" diagnostic, s= o >>> that it doesn't preclude other diagnostics? I'll have a look. Well, >>> maybe something like: in fact do not default to '-fno-exceptions', but >>> instead emit 'error: exception handling disabled' only if in a "really >>> late" pass we run into exceptions-related constructs that we cannot >>> support. That'd also avoid PASS -> UNSUPPORTED "regressions" when >>> exception handling in fact gets optimized away, for example. I like th= at >>> idea, conceptually -- but is it feasible to implement..?) >> >> IMHO just [...] using [an effective target keyword] in test >> selectors seems simpler, and doesn't require changes to the compiler, ju= st >> the tests. > > I still like the idea, but yes, I've mentally put it on file "for later" > (ha, ha, ha...) -- it doesn't seem obvious to implement. > > > Gr=C3=BC=C3=9Fe > Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename="0001-Skip-a-number-of-C-g-.dg-tree-prof-test-cases-for-fn.patch" >From 9d9c1430c569e661913a3f5dc59fceaa03cc935d Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 14 Jun 2023 22:39:01 +0200 Subject: [PATCH] Skip a number of C++ 'g++.dg/tree-prof/' test cases for '-fno-exceptions' testing Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions', 'error: exception handling disabled' is triggered for C++ 'throw' etc. usage, and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune': # If exceptions are disabled, mark tests expecting exceptions to be enabled # as unsupported. if { ![check_effective_target_exceptions_enabled] } { if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] { return "::unsupported::exception handling disabled" } ..., which generally means: -PASS: [...] (test for excess errors) +UNSUPPORTED: [...]: exception handling disabled However, this doesn't work for 'g++.dg/tree-prof/' test cases. For example: [-PASS: g++.dg/tree-prof/indir-call-prof-2.C compilation, -fprofile-generate -D_PROFILE_GENERATE-] [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C compilation, -fprofile-use -D_PROFILE_USE [-PASS:-]{+UNSUPPORTED: g++.dg/tree-prof/indir-call-prof-2.C compilation: exception handling disabled+} {+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C execution, -fprofile-generate -D_PROFILE_GENERATE [-PASS:-]{+UNRESOLVED:+} g++.dg/tree-prof/indir-call-prof-2.C execution, -fprofile-use -D_PROFILE_USE Dependent parts turn UNRESOLVED if "compilation" runs into the expected 'UNSUPPORTED: [...] compile: exception handling disabled'. Specify 'dg-require-effective-target exceptions_enabled' for those test cases. gcc/testsuite/ * g++.dg/tree-prof/indir-call-prof-2.C: Specify 'dg-require-effective-target exceptions_enabled'. * g++.dg/tree-prof/partition1.C: Likewise. * g++.dg/tree-prof/partition2.C: Likewise. * g++.dg/tree-prof/partition3.C: Likewise. * g++.dg/tree-prof/pr51719.C: Likewise. * g++.dg/tree-prof/pr57451.C: Likewise. * g++.dg/tree-prof/pr59255.C: Likewise. --- gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C | 1 + gcc/testsuite/g++.dg/tree-prof/partition1.C | 1 + gcc/testsuite/g++.dg/tree-prof/partition2.C | 1 + gcc/testsuite/g++.dg/tree-prof/partition3.C | 1 + gcc/testsuite/g++.dg/tree-prof/pr51719.C | 1 + gcc/testsuite/g++.dg/tree-prof/pr57451.C | 1 + gcc/testsuite/g++.dg/tree-prof/pr59255.C | 1 + 7 files changed, 7 insertions(+) diff --git a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C index e20cc64d373..497282db376 100644 --- a/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C +++ b/gcc/testsuite/g++.dg/tree-prof/indir-call-prof-2.C @@ -1,3 +1,4 @@ +/* { dg-require-effective-target exceptions_enabled } */ /* { dg-options "-O" } */ int foo1(void) { return 0; } diff --git a/gcc/testsuite/g++.dg/tree-prof/partition1.C b/gcc/testsuite/g++.dg/tree-prof/partition1.C index d0dcbc4524b..a7c9cd5ba7f 100644 --- a/gcc/testsuite/g++.dg/tree-prof/partition1.C +++ b/gcc/testsuite/g++.dg/tree-prof/partition1.C @@ -1,3 +1,4 @@ +/* { dg-require-effective-target exceptions_enabled } */ /* { dg-require-effective-target freorder } */ /* { dg-options "-O2 -freorder-blocks-and-partition" } */ diff --git a/gcc/testsuite/g++.dg/tree-prof/partition2.C b/gcc/testsuite/g++.dg/tree-prof/partition2.C index 0bc50fae98a..512c1274140 100644 --- a/gcc/testsuite/g++.dg/tree-prof/partition2.C +++ b/gcc/testsuite/g++.dg/tree-prof/partition2.C @@ -1,4 +1,5 @@ // PR middle-end/45458 +/* { dg-require-effective-target exceptions_enabled } */ // { dg-require-effective-target freorder } // { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition" } diff --git a/gcc/testsuite/g++.dg/tree-prof/partition3.C b/gcc/testsuite/g++.dg/tree-prof/partition3.C index c62174aa4d3..48a850ddfae 100644 --- a/gcc/testsuite/g++.dg/tree-prof/partition3.C +++ b/gcc/testsuite/g++.dg/tree-prof/partition3.C @@ -1,4 +1,5 @@ // PR middle-end/45566 +// { dg-require-effective-target exceptions_enabled } // { dg-require-effective-target freorder } // { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition" } diff --git a/gcc/testsuite/g++.dg/tree-prof/pr51719.C b/gcc/testsuite/g++.dg/tree-prof/pr51719.C index 01e81ff66ed..7c568eb537f 100644 --- a/gcc/testsuite/g++.dg/tree-prof/pr51719.C +++ b/gcc/testsuite/g++.dg/tree-prof/pr51719.C @@ -1,4 +1,5 @@ // PR tree-optimization/51719 +// { dg-require-effective-target exceptions_enabled } // { dg-options "-O -fpartial-inlining" } int diff --git a/gcc/testsuite/g++.dg/tree-prof/pr57451.C b/gcc/testsuite/g++.dg/tree-prof/pr57451.C index db0fcc1e8ef..a530e9053e2 100644 --- a/gcc/testsuite/g++.dg/tree-prof/pr57451.C +++ b/gcc/testsuite/g++.dg/tree-prof/pr57451.C @@ -1,3 +1,4 @@ +// { dg-require-effective-target exceptions_enabled } // { dg-require-effective-target freorder } // { dg-options "-O2 -freorder-blocks-and-partition -g" } diff --git a/gcc/testsuite/g++.dg/tree-prof/pr59255.C b/gcc/testsuite/g++.dg/tree-prof/pr59255.C index 77f208a3a5f..a5ee03c2cca 100644 --- a/gcc/testsuite/g++.dg/tree-prof/pr59255.C +++ b/gcc/testsuite/g++.dg/tree-prof/pr59255.C @@ -1,4 +1,5 @@ // PR c++/59255 +// { dg-require-effective-target exceptions_enabled } // { dg-options "-std=c++11 -O2" } struct S -- 2.34.1 --=-=-=--