From: Jakub Jelinek Date: Tue, 23 Jan 2018 20:36:34 +0000 (+0100) Subject: re PR sanitizer/83987 (ICE with OpenMP, sanitizer and virtual bases) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=508d0c3da24c91bdabf7fbd453b511bfccbb2958;p=gcc.git re PR sanitizer/83987 (ICE with OpenMP, sanitizer and virtual bases) PR sanitizer/83987 * tree.c (cp_free_lang_data): Change DECL_VALUE_EXPR of DECL_OMP_PRIVATIZED_MEMBER vars to error_mark_node. * g++.dg/ubsan/pr83987.C: New test. From-SVN: r256997 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 97c54ac9a00..a0a3c13d993 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-01-23 Jakub Jelinek + + 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 PR c++/83988 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index ed51c28858f..e87c59659a5 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 c52b2d96d4f..ce9c3c8e10b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,12 +1,17 @@ -2018-23-01 Paul Thomas +2018-01-23 Jakub Jelinek + + PR sanitizer/83987 + * g++.dg/ubsan/pr83987.C: New test. + +2018-01-23 Paul Thomas PR fortran/83866 - * gfortran.dg/pdt_29.f03 : New test. + * gfortran.dg/pdt_29.f03: New test. -2018-23-01 Paul Thomas +2018-01-23 Paul Thomas PR fortran/83898 - * gfortran.dg/associate_33.f03 : New test. + * gfortran.dg/associate_33.f03: New test. 2018-01-23 Martin Liska @@ -1704,7 +1709,7 @@ 2018-01-13 Paul Thomas PR fortran/52162 - * gfortran.dg/bounds_check_19.f90 : New test. + * gfortran.dg/bounds_check_19.f90: New test. 2018-01-12 Jakub Jelinek @@ -2262,12 +2267,12 @@ 2018-01-08 Paul Thomas 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 @@ -2562,10 +2567,10 @@ 2018-01-01 Paul Thomas 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 diff --git a/gcc/testsuite/g++.dg/ubsan/pr83987.C b/gcc/testsuite/g++.dg/ubsan/pr83987.C new file mode 100644 index 00000000000..7ba7952b293 --- /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; + } +}