From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61351 invoked by alias); 9 Jul 2019 11:01:53 -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 61250 invoked by uid 89); 9 Jul 2019 11:01:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,MISSING_HEADERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Jul 2019 11:01:40 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1hknsP-0006jc-LV from Andrew_Stubbs@mentor.com for gcc-patches@gcc.gnu.org; Tue, 09 Jul 2019 04:01:37 -0700 Received: from [127.0.0.1] (137.202.0.90) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Tue, 9 Jul 2019 12:01:34 +0100 Subject: [OG9] Improve diagnostics for unmappable types CC: "gcc-patches@gcc.gnu.org" References: <9471094d-05b6-0196-02c5-f7868f139332@codesourcery.com> <2b79b444-1c95-b821-d472-a1304f363441@redhat.com> <107c7b3d-fd9d-103a-3c23-84a7f78cd99a@codesourcery.com> <20190708221028.GL815@tucnak> From: Andrew Stubbs Message-ID: <10503723-7abd-7b83-c680-bfeab7989cd1@codesourcery.com> Date: Tue, 09 Jul 2019 11:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190708221028.GL815@tucnak> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2019-07/txt/msg00680.txt.bz2 I've backported Jakub's patch to openacc-gcc-9-branch. Andrew On 08/07/2019 23:10, Jakub Jelinek wrote: > On Thu, Jul 04, 2019 at 12:44:32PM +0100, Andrew Stubbs wrote: >> On 03/07/2019 18:58, Jason Merrill wrote: >>> OK, thanks. >> >> Committed. > > This broke following testcase. > error_mark_node type isn't really incomplete, it is errorneous, doesn't have > TYPE_MAIN_DECL and we should have diagnosed it earlier, so it makes no sense > to emit extra explanation messages. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, > committed to trunk. > > 2019-07-08 Jakub Jelinek > > PR c++/91110 > * decl2.c (cp_omp_mappable_type_1): Don't emit any note for > error_mark_node type. > > * g++.dg/gomp/pr91110.C: New test. > > --- gcc/cp/decl2.c.jj 2019-07-04 23:39:02.579106113 +0200 > +++ gcc/cp/decl2.c 2019-07-08 13:22:52.552898230 +0200 > @@ -1416,7 +1416,7 @@ cp_omp_mappable_type_1 (tree type, bool > /* Mappable type has to be complete. */ > if (type == error_mark_node || !COMPLETE_TYPE_P (type)) > { > - if (notes) > + if (notes && type != error_mark_node) > { > tree decl = TYPE_MAIN_DECL (type); > inform ((decl ? DECL_SOURCE_LOCATION (decl) : input_location), > --- gcc/testsuite/g++.dg/gomp/pr91110.C.jj 2019-07-08 13:29:43.803163534 +0200 > +++ gcc/testsuite/g++.dg/gomp/pr91110.C 2019-07-08 13:29:17.550593456 +0200 > @@ -0,0 +1,11 @@ > +// PR c++/91110 > +// { dg-do compile } > + > +void > +foo () > +{ > + X b[2]; // { dg-error "'X' was not declared in this scope" } > + b[0] = 1; // { dg-error "'b' was not declared in this scope" } > + #pragma omp target map(to: b) // { dg-error "'b' does not have a mappable type in 'map' clause" } > + ; > +} > > > Jakub >