public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [committed] c++: Ensure OpenMP reduction with reference type references complete type [PR101516]
Date: Wed, 21 Jul 2021 09:51:55 +0200	[thread overview]
Message-ID: <20210721075155.GK2380545@tucnak> (raw)

Hi!

The following testcase ICEs because we haven't verified if reduction decl
has reference type that TREE_TYPE of the reference is a complete type,
require_complete_type on the decl doesn't ensure that.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2021-07-21  Jakub Jelinek  <jakub@redhat.com>

	PR c++/101516
	* semantics.c (finish_omp_reduction_clause): Also call
	complete_type_or_else and return true if it fails.

	* g++.dg/gomp/pr101516.C: New test.

--- gcc/cp/semantics.c.jj	2021-07-15 10:16:12.972581906 +0200
+++ gcc/cp/semantics.c	2021-07-20 13:31:04.972039268 +0200
@@ -6070,7 +6070,8 @@ finish_omp_reduction_clause (tree c, boo
       if (!processing_template_decl)
 	{
 	  t = require_complete_type (t);
-	  if (t == error_mark_node)
+	  if (t == error_mark_node
+	      || !complete_type_or_else (oatype, NULL_TREE))
 	    return true;
 	  tree size = size_binop (EXACT_DIV_EXPR, TYPE_SIZE_UNIT (oatype),
 				  TYPE_SIZE_UNIT (type));
--- gcc/testsuite/g++.dg/gomp/pr101516.C.jj	2021-07-20 13:51:41.690789542 +0200
+++ gcc/testsuite/g++.dg/gomp/pr101516.C	2021-07-20 13:51:16.463141545 +0200
@@ -0,0 +1,8 @@
+// PR c++/101516
+
+void
+foo (int (&v) [])
+{
+  #pragma omp parallel reduction (+:v)	// { dg-error "invalid use of array with unspecified bounds" }
+  ;
+}

	Jakub


                 reply	other threads:[~2021-07-21  7:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210721075155.GK2380545@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).