public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Andrew Stubbs <ams@codesourcery.com>
Cc: Jason Merrill <jason@redhat.com>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, c++ openmp] Improve diagnostics for unmappable types
Date: Mon, 08 Jul 2019 22:13:00 -0000	[thread overview]
Message-ID: <20190708221028.GL815@tucnak> (raw)
In-Reply-To: <107c7b3d-fd9d-103a-3c23-84a7f78cd99a@codesourcery.com>

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  <jakub@redhat.com>

	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

  reply	other threads:[~2019-07-08 22:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 10:46 Andrew Stubbs
2019-06-28 16:21 ` Jason Merrill
2019-07-01 11:16   ` Andrew Stubbs
2019-07-03 18:36     ` Jason Merrill
2019-07-04 12:14       ` Andrew Stubbs
2019-07-08 22:13         ` Jakub Jelinek [this message]
2019-07-09  9:59           ` Andrew Stubbs
2019-07-09 11:03           ` [OG9] " Andrew Stubbs
2019-07-04 14:38     ` Andrew Stubbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190708221028.GL815@tucnak \
    --to=jakub@redhat.com \
    --cc=ams@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).