[Bug c++/93931] ICE using lambda capture in openMP parallel for reduction

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 18 18:51:23 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93931

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think we need also:
--- gcc/cp/cp-gimplify.c.jj     2020-03-11 09:28:53.964213973 +0100
+++ gcc/cp/cp-gimplify.c        2020-03-18 19:09:53.281323970 +0100
@@ -2260,12 +2260,17 @@ cxx_omp_finish_clause (tree c, gimple_se
 bool
 cxx_omp_disregard_value_expr (tree decl, bool shared)
 {
-  return !shared
-        && VAR_P (decl)
-        && DECL_HAS_VALUE_EXPR_P (decl)
-        && DECL_ARTIFICIAL (decl)
-        && DECL_LANG_SPECIFIC (decl)
-        && DECL_OMP_PRIVATIZED_MEMBER (decl);
+  if (shared)
+    return false;
+  if (VAR_P (decl)
+      && DECL_HAS_VALUE_EXPR_P (decl)
+      && DECL_ARTIFICIAL (decl)
+      && DECL_LANG_SPECIFIC (decl)
+      && DECL_OMP_PRIVATIZED_MEMBER (decl))
+    return true;
+  if (is_capture_proxy (decl))
+    return true;
+  return false;
 }

 /* Fold expression X which is used as an rvalue if RVAL is true.  */

but will need as well proper testsuite coverage for using OpenMP constructs in
lambdas; in OpenMP 4.5 and earlier that wasn't well defined, but in OpenMP 5.0
which we (partially) support now it is.


More information about the Gcc-bugs mailing list