mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-30 15:24:07 +08:00
semantics.c (handle_omp_array_sections_1): Don't ICE when processing_template_decl when checking for bitfields and unions.
* semantics.c (handle_omp_array_sections_1): Don't ICE when processing_template_decl when checking for bitfields and unions. Look through REFERENCE_REF_P as base of COMPONENT_REF. (finish_omp_clauses): Look through REFERENCE_REF_P even for array sections with COMPONENT_REF bases. * testsuite/libgomp.c++/target-21.C: New test. From-SVN: r237554
This commit is contained in:
parent
6ffccb58d6
commit
9b6a8d0fd1
@ -1,3 +1,11 @@
|
||||
2016-06-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* semantics.c (handle_omp_array_sections_1): Don't ICE when
|
||||
processing_template_decl when checking for bitfields and unions.
|
||||
Look through REFERENCE_REF_P as base of COMPONENT_REF.
|
||||
(finish_omp_clauses): Look through REFERENCE_REF_P even for
|
||||
array sections with COMPONENT_REF bases.
|
||||
|
||||
2016-06-16 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* parser.c (cp_parser_omp_var_list_no_open): Call
|
||||
|
@ -4487,7 +4487,8 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
|
||||
|| OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FROM)
|
||||
&& !type_dependent_expression_p (t))
|
||||
{
|
||||
if (DECL_BIT_FIELD (TREE_OPERAND (t, 1)))
|
||||
if (TREE_CODE (TREE_OPERAND (t, 1)) == FIELD_DECL
|
||||
&& DECL_BIT_FIELD (TREE_OPERAND (t, 1)))
|
||||
{
|
||||
error_at (OMP_CLAUSE_LOCATION (c),
|
||||
"bit-field %qE in %qs clause",
|
||||
@ -4496,7 +4497,8 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
|
||||
}
|
||||
while (TREE_CODE (t) == COMPONENT_REF)
|
||||
{
|
||||
if (TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == UNION_TYPE)
|
||||
if (TREE_TYPE (TREE_OPERAND (t, 0))
|
||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == UNION_TYPE)
|
||||
{
|
||||
error_at (OMP_CLAUSE_LOCATION (c),
|
||||
"%qE is a member of a union", t);
|
||||
@ -4504,6 +4506,8 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types,
|
||||
}
|
||||
t = TREE_OPERAND (t, 0);
|
||||
}
|
||||
if (REFERENCE_REF_P (t))
|
||||
t = TREE_OPERAND (t, 0);
|
||||
}
|
||||
if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL)
|
||||
{
|
||||
@ -6623,6 +6627,8 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
|
||||
{
|
||||
while (TREE_CODE (t) == COMPONENT_REF)
|
||||
t = TREE_OPERAND (t, 0);
|
||||
if (REFERENCE_REF_P (t))
|
||||
t = TREE_OPERAND (t, 0);
|
||||
if (bitmap_bit_p (&map_field_head, DECL_UID (t)))
|
||||
break;
|
||||
if (bitmap_bit_p (&map_head, DECL_UID (t)))
|
||||
|
@ -1,3 +1,7 @@
|
||||
2016-06-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* testsuite/libgomp.c++/target-21.C: New test.
|
||||
|
||||
2016-06-16 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* testsuite/libgomp.c++/target-20.C: New test.
|
||||
|
173
libgomp/testsuite/libgomp.c++/target-21.C
Normal file
173
libgomp/testsuite/libgomp.c++/target-21.C
Normal file
@ -0,0 +1,173 @@
|
||||
extern "C" void abort ();
|
||||
struct T { char t[270]; };
|
||||
struct S { int (&x)[10]; int *&y; T t; int &z; S (); ~S (); };
|
||||
|
||||
template <int N>
|
||||
void
|
||||
foo (S s)
|
||||
{
|
||||
int err;
|
||||
#pragma omp target map (s.x[0:N], s.y[0:N]) map (s.t.t[16:3]) map (from: err)
|
||||
{
|
||||
err = s.x[2] != 28 || s.y[2] != 37 || s.t.t[17] != 81;
|
||||
s.x[2]++;
|
||||
s.y[2]++;
|
||||
s.t.t[17]++;
|
||||
}
|
||||
if (err || s.x[2] != 29 || s.y[2] != 38 || s.t.t[17] != 82)
|
||||
abort ();
|
||||
}
|
||||
|
||||
template <int N>
|
||||
void
|
||||
bar (S s)
|
||||
{
|
||||
int err;
|
||||
#pragma omp target map (s.x, s.z)map(from:err)
|
||||
{
|
||||
err = s.x[2] != 29 || s.z != 6;
|
||||
s.x[2]++;
|
||||
s.z++;
|
||||
}
|
||||
if (err || s.x[2] != 30 || s.z != 7)
|
||||
abort ();
|
||||
}
|
||||
|
||||
template <int N>
|
||||
void
|
||||
foo2 (S &s)
|
||||
{
|
||||
int err;
|
||||
#pragma omp target map (s.x[N:10], s.y[N:10]) map (from: err) map (s.t.t[N+16:N+3])
|
||||
{
|
||||
err = s.x[2] != 30 || s.y[2] != 38 || s.t.t[17] != 81;
|
||||
s.x[2]++;
|
||||
s.y[2]++;
|
||||
s.t.t[17]++;
|
||||
}
|
||||
if (err || s.x[2] != 31 || s.y[2] != 39 || s.t.t[17] != 82)
|
||||
abort ();
|
||||
}
|
||||
|
||||
template <int N>
|
||||
void
|
||||
bar2 (S &s)
|
||||
{
|
||||
int err;
|
||||
#pragma omp target map (s.x, s.z)map(from:err)
|
||||
{
|
||||
err = s.x[2] != 31 || s.z != 7;
|
||||
s.x[2]++;
|
||||
s.z++;
|
||||
}
|
||||
if (err || s.x[2] != 32 || s.z != 8)
|
||||
abort ();
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
void
|
||||
foo3 (U s)
|
||||
{
|
||||
int err;
|
||||
#pragma omp target map (s.x[0:10], s.y[0:10]) map (from: err) map (s.t.t[16:3])
|
||||
{
|
||||
err = s.x[2] != 32 || s.y[2] != 39 || s.t.t[17] != 82;
|
||||
s.x[2]++;
|
||||
s.y[2]++;
|
||||
s.t.t[17]++;
|
||||
}
|
||||
if (err || s.x[2] != 33 || s.y[2] != 40 || s.t.t[17] != 83)
|
||||
abort ();
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
void
|
||||
bar3 (U s)
|
||||
{
|
||||
int err;
|
||||
#pragma omp target map (s.x, s.z)map(from:err)
|
||||
{
|
||||
err = s.x[2] != 33 || s.z != 8;
|
||||
s.x[2]++;
|
||||
s.z++;
|
||||
}
|
||||
if (err || s.x[2] != 34 || s.z != 9)
|
||||
abort ();
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
void
|
||||
foo4 (U &s)
|
||||
{
|
||||
int err;
|
||||
#pragma omp target map (s.x[0:10], s.y[0:10]) map (from: err) map (s.t.t[16:3])
|
||||
{
|
||||
err = s.x[2] != 34 || s.y[2] != 40 || s.t.t[17] != 82;
|
||||
s.x[2]++;
|
||||
s.y[2]++;
|
||||
s.t.t[17]++;
|
||||
}
|
||||
if (err || s.x[2] != 35 || s.y[2] != 41 || s.t.t[17] != 83)
|
||||
abort ();
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
void
|
||||
bar4 (U &s)
|
||||
{
|
||||
int err;
|
||||
#pragma omp target map (s.x, s.z)map(from:err)
|
||||
{
|
||||
err = s.x[2] != 35 || s.z != 9;
|
||||
s.x[2]++;
|
||||
s.z++;
|
||||
}
|
||||
if (err || s.x[2] != 36 || s.z != 10)
|
||||
abort ();
|
||||
}
|
||||
|
||||
int xt[10] = { 1, 2, 28, 3, 4, 5, 6, 7, 8, 9 };
|
||||
int yt[10] = { 1, 2, 37, 3, 4, 5, 6, 7, 8, 9 };
|
||||
int *yp = yt;
|
||||
int zt = 6;
|
||||
|
||||
S::S () : x (xt), y (yp), z (zt)
|
||||
{
|
||||
}
|
||||
|
||||
S::~S ()
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
S s;
|
||||
s.t.t[16] = 5;
|
||||
s.t.t[17] = 81;
|
||||
s.t.t[18] = 9;
|
||||
foo <10> (s);
|
||||
if (s.t.t[17] != 81)
|
||||
abort ();
|
||||
bar <7> (s);
|
||||
foo2 <0> (s);
|
||||
if (s.t.t[17] != 82)
|
||||
abort ();
|
||||
bar2 <21> (s);
|
||||
foo3 <S> (s);
|
||||
if (s.t.t[17] != 82)
|
||||
abort ();
|
||||
bar3 <S> (s);
|
||||
foo4 <S> (s);
|
||||
if (s.t.t[17] != 83)
|
||||
abort ();
|
||||
bar4 <S> (s);
|
||||
s.x[2] -= 4;
|
||||
s.y[2] -= 2;
|
||||
s.z -= 2;
|
||||
s.t.t[17]--;
|
||||
foo3 <S &> (s);
|
||||
if (s.t.t[17] != 83)
|
||||
abort ();
|
||||
bar3 <S &> (s);
|
||||
}
|
Loading…
Reference in New Issue
Block a user