[committed] openmp: Fix up handling of DECL_OMP_PRIVATIZED_MEMBER for bit-fields [PR95063]
Jakub Jelinek
jakub@redhat.com
Tue May 12 08:07:01 GMT 2020
Hi!
The r11-15 change broke this testcase, as it now asserts type is equal to
the type of the DECL_VALUE_EXPR, but for DECL_OMP_PRIVATIZED_MEMBER artificial
vars mapping to bitfields it wasn't. Fixed by changing the
DECL_OMP_PRIVATIZED_MEMBER var type in that case.
Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.
2020-05-12 Jakub Jelinek <jakub@redhat.com>
PR c++/95063
* pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
a bit-field.
* g++.dg/gomp/pr95063.C: New test.
--- gcc/cp/pt.c.jj 2020-05-07 11:10:25.644548337 +0200
+++ gcc/cp/pt.c 2020-05-11 23:16:31.070378604 +0200
@@ -14627,6 +14627,12 @@ tsubst_decl (tree t, tree args, tsubst_f
}
if (nop)
ve = build_nop (type, ve);
+ else if (DECL_LANG_SPECIFIC (t)
+ && DECL_OMP_PRIVATIZED_MEMBER (t)
+ && TREE_CODE (ve) == COMPONENT_REF
+ && TREE_CODE (TREE_OPERAND (ve, 1)) == FIELD_DECL
+ && DECL_BIT_FIELD_TYPE (TREE_OPERAND (ve, 1)) == type)
+ type = TREE_TYPE (ve);
else
gcc_checking_assert (TREE_TYPE (ve) == type);
SET_DECL_VALUE_EXPR (r, ve);
--- gcc/testsuite/g++.dg/gomp/pr95063.C.jj 2020-05-11 19:35:30.680174343 +0200
+++ gcc/testsuite/g++.dg/gomp/pr95063.C 2020-05-11 19:34:53.138731112 +0200
@@ -0,0 +1,24 @@
+// PR c++/95063
+
+template <typename T>
+struct S {
+ T a : 12;
+ S () : a(0)
+ {
+#pragma omp for linear(a)
+ for (int k = 0; k < 64; ++k)
+ a++;
+ }
+};
+struct U {
+ int a : 12;
+ U () : a(0)
+ {
+#pragma omp for linear(a)
+ for (int k = 0; k < 64; ++k)
+ a++;
+ }
+};
+
+S<int> s;
+U u;
Jakub
More information about the Gcc-patches
mailing list