mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
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.
This commit is contained in:
parent
b3d4011ba1
commit
aea199f96c
@ -6070,7 +6070,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));
|
||||
|
8
gcc/testsuite/g++.dg/gomp/pr101516.C
Normal file
8
gcc/testsuite/g++.dg/gomp/pr101516.C
Normal file
@ -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" }
|
||||
;
|
||||
}
|
Loading…
Reference in New Issue
Block a user