public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/autopar_devel] openmp: Fix up handling of DECL_OMP_PRIVATIZED_MEMBER for bit-fields [PR95063]
@ 2020-08-22 21:08 Giuliano Belinassi
  0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2020-08-22 21:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4f4e428bd95e26b533c7ea73cfe9d97fd3031781

commit 4f4e428bd95e26b533c7ea73cfe9d97fd3031781
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue May 12 10:00:32 2020 +0200

    openmp: Fix up handling of DECL_OMP_PRIVATIZED_MEMBER for bit-fields [PR95063]
    
    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.
    
    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.

Diff:
---
 gcc/cp/ChangeLog                    |  6 ++++++
 gcc/cp/pt.c                         |  6 ++++++
 gcc/testsuite/ChangeLog             |  5 +++++
 gcc/testsuite/g++.dg/gomp/pr95063.C | 24 ++++++++++++++++++++++++
 4 files changed, 41 insertions(+)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5cf9dda42e2..db80907ef4d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
 2020-05-11  Jason Merrill  <jason@redhat.com>
 
 	Resolve C++20 NB comment CA104
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 84864561c25..7911293571e 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14627,6 +14627,12 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
 		  }
 		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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dc7eb3141a4..0c8a73a30a4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-12  Jakub Jelinek  <jakub@redhat.com>
+
+	PR c++/95063
+	* g++.dg/gomp/pr95063.C: New test.
+
 2020-05-12  Richard Sandiford  <richard.sandiford@arm.com>
 
 	PR tree-optimization/94980
diff --git a/gcc/testsuite/g++.dg/gomp/pr95063.C b/gcc/testsuite/g++.dg/gomp/pr95063.C
new file mode 100644
index 00000000000..fe5894c73b0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr95063.C
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-22 21:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 21:08 [gcc/devel/autopar_devel] openmp: Fix up handling of DECL_OMP_PRIVATIZED_MEMBER for bit-fields [PR95063] Giuliano Belinassi

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).