aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/tree.c10
-rw-r--r--gcc/testsuite/ChangeLog27
-rw-r--r--gcc/testsuite/g++.dg/ubsan/pr83987.C15
4 files changed, 47 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 97c54ac..a0a3c13 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/83987
+ * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of
+ DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node.
+
2018-01-23 Nathan Sidwell <nathan@acm.org>
PR c++/83988
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index ed51c28..e87c596 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -5274,6 +5274,16 @@ cp_free_lang_data (tree t)
/* We do not need the leftover chaining of namespaces from the
binding level. */
DECL_CHAIN (t) = NULL_TREE;
+ /* Set DECL_VALUE_EXPRs of OpenMP privatized member artificial
+ decls to error_mark_node. These are DECL_IGNORED_P and after
+ OpenMP lowering they aren't useful anymore. Clearing DECL_VALUE_EXPR
+ doesn't work, as expansion could then consider them as something
+ to be expanded. */
+ if (VAR_P (t)
+ && DECL_LANG_SPECIFIC (t)
+ && DECL_OMP_PRIVATIZED_MEMBER (t)
+ && DECL_IGNORED_P (t))
+ SET_DECL_VALUE_EXPR (t, error_mark_node);
}
/* Stub for c-common. Please keep in sync with c-decl.c.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c52b2d9..ce9c3c8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,12 +1,17 @@
-2018-23-01 Paul Thomas <pault@gcc.gnu.org>
+2018-01-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/83987
+ * g++.dg/ubsan/pr83987.C: New test.
+
+2018-01-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83866
- * gfortran.dg/pdt_29.f03 : New test.
+ * gfortran.dg/pdt_29.f03: New test.
-2018-23-01 Paul Thomas <pault@gcc.gnu.org>
+2018-01-23 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83898
- * gfortran.dg/associate_33.f03 : New test.
+ * gfortran.dg/associate_33.f03: New test.
2018-01-23 Martin Liska <mliska@suse.cz>
@@ -1704,7 +1709,7 @@
2018-01-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/52162
- * gfortran.dg/bounds_check_19.f90 : New test.
+ * gfortran.dg/bounds_check_19.f90: New test.
2018-01-12 Jakub Jelinek <jakub@redhat.com>
@@ -2262,12 +2267,12 @@
2018-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83611
- * gfortran.dg/pdt_15.f03 : Bump count of 'n.data = 0B' to 8.
- * gfortran.dg/pdt_26.f03 : Bump count of '_malloc' to 9.
- * gfortran.dg/pdt_27.f03 : New test.
+ * gfortran.dg/pdt_15.f03: Bump count of 'n.data = 0B' to 8.
+ * gfortran.dg/pdt_26.f03: Bump count of '_malloc' to 9.
+ * gfortran.dg/pdt_27.f03: New test.
PR fortran/83731
- * gfortran.dg/pdt_28.f03 : New test.
+ * gfortran.dg/pdt_28.f03: New test.
2018-01-08 Tom de Vries <tom@codesourcery.com>
@@ -2562,10 +2567,10 @@
2018-01-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/83076
- * gfortran.dg/coarray_45.f90 : New test.
+ * gfortran.dg/coarray_45.f90: New test.
PR fortran/83319
- * gfortran.dg/coarray_46.f90 : New test.
+ * gfortran.dg/coarray_46.f90: New test.
2018-01-01 Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/testsuite/g++.dg/ubsan/pr83987.C b/gcc/testsuite/g++.dg/ubsan/pr83987.C
new file mode 100644
index 0000000..7ba7952
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ubsan/pr83987.C
@@ -0,0 +1,15 @@
+// PR sanitizer/83987
+// { dg-do compile { target fopenmp } }
+// { dg-options "-fopenmp -fsanitize=vptr -O0" }
+
+struct A { int i; };
+struct B : virtual A { void foo (); };
+
+void
+B::foo ()
+{
+#pragma omp sections lastprivate (i)
+ {
+ i = 0;
+ }
+}