public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10636] c++: Ensure OpenMP reduction with reference type references complete type [PR101516] Date: Tue, 10 May 2022 08:20:07 +0000 (GMT) [thread overview] Message-ID: <20220510082007.442D738346B2@sourceware.org> (raw) https://gcc.gnu.org/g:17a947ee50f8b8e01022a31bc69729f2dc563dd8 commit r10-10636-g17a947ee50f8b8e01022a31bc69729f2dc563dd8 Author: Jakub Jelinek <jakub@redhat.com> Date: Wed Jul 21 09:38:59 2021 +0200 c++: Ensure OpenMP reduction with reference type references complete type [PR101516] 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. 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. (cherry picked from commit aea199f96cf116ba4c81426207acde371556610c) Diff: --- gcc/cp/semantics.c | 3 ++- gcc/testsuite/g++.dg/gomp/pr101516.C | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0d2ba529a29..4c6f70804c1 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5806,7 +5806,8 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor) 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)); diff --git a/gcc/testsuite/g++.dg/gomp/pr101516.C b/gcc/testsuite/g++.dg/gomp/pr101516.C new file mode 100644 index 00000000000..48f60de6bb0 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr101516.C @@ -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" } + ; +}
reply other threads:[~2022-05-10 8:20 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=20220510082007.442D738346B2@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).