public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-18 17:56 ` jakub at gcc dot gnu.org
2020-03-18 18:51 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-18 17:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93931
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/cp/parser.c.jj 2020-03-18 13:36:34.217840388 +0100
+++ gcc/cp/parser.c 2020-03-18 18:52:53.630586929 +0100
@@ -34059,6 +34059,8 @@ cp_parser_omp_var_list_no_open (cp_parse
token->location);
}
}
+ if (outer_automatic_var_p (decl))
+ decl = process_outer_var_ref (decl, tf_warning_or_error);
if (decl == error_mark_node)
;
else if (kind != 0)
fixes the ICE, but doesn't seem to be enough, for some reason gimplification
still replaces the uses of score inside of the body with __closure->score
access, which is wrong.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
2020-03-18 17:56 ` [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction jakub at gcc dot gnu.org
@ 2020-03-18 18:51 ` jakub at gcc dot gnu.org
2020-03-19 11:28 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-18 18:51 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
2020-03-18 17:56 ` [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction jakub at gcc dot gnu.org
2020-03-18 18:51 ` jakub at gcc dot gnu.org
@ 2020-03-19 11:28 ` cvs-commit at gcc dot gnu.org
2020-03-19 12:05 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-19 11:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93931
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:02f7334ac93f53ed06d881beb611e88be36dc56a
commit r10-7276-g02f7334ac93f53ed06d881beb611e88be36dc56a
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Mar 19 12:22:47 2020 +0100
c++: Fix up handling of captured vars in lambdas in OpenMP clauses
[PR93931]
Without the parser.c change we were ICEing on the testcase, because while
the
uses of the captured vars inside of the constructs were replaced with
capture
proxy decls, we didn't do that for decls in OpenMP clauses.
With that fixed, we don't ICE anymore, but the testcase is miscompiled and
FAILs
at runtime. This is because the capture proxy decls have DECL_VALUE_EXPR
and
during gimplification we were gimplifying those to their DECL_VALUE_EXPRs.
That is fine for shared vars, but for privatized ones we must not do that.
So that is what the cp-gimplify.c changes do. Had to add a DECL_CONTEXT
check
before calling is_capture_proxy because some VAR_DECLs don't have
DECL_CONTEXT
set (yet) and is_capture_proxy relies on that being non-NULL always.
2020-03-19 Jakub Jelinek <jakub@redhat.com>
PR c++/93931
* parser.c (cp_parser_omp_var_list_no_open): Call
process_outer_var_ref
on outer_automatic_var_p decls.
* cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also
for
capture proxy decls.
* testsuite/libgomp.c++/pr93931.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-03-19 11:28 ` cvs-commit at gcc dot gnu.org
@ 2020-03-19 12:05 ` jakub at gcc dot gnu.org
2020-04-07 19:03 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-19 12:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93931
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2020-03-19
Status|UNCONFIRMED |ASSIGNED
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 10+ so far, will wait a while before backporting.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2020-03-19 12:05 ` jakub at gcc dot gnu.org
@ 2020-04-07 19:03 ` cvs-commit at gcc dot gnu.org
2020-09-17 14:25 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-07 19:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93931
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:484206967f958fc47827a71654fe52a98adc95cb
commit r9-8465-g484206967f958fc47827a71654fe52a98adc95cb
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Mar 19 12:22:47 2020 +0100
c++: Fix up handling of captured vars in lambdas in OpenMP clauses
[PR93931]
Without the parser.c change we were ICEing on the testcase, because while
the
uses of the captured vars inside of the constructs were replaced with
capture
proxy decls, we didn't do that for decls in OpenMP clauses.
With that fixed, we don't ICE anymore, but the testcase is miscompiled and
FAILs
at runtime. This is because the capture proxy decls have DECL_VALUE_EXPR
and
during gimplification we were gimplifying those to their DECL_VALUE_EXPRs.
That is fine for shared vars, but for privatized ones we must not do that.
So that is what the cp-gimplify.c changes do. Had to add a DECL_CONTEXT
check
before calling is_capture_proxy because some VAR_DECLs don't have
DECL_CONTEXT
set (yet) and is_capture_proxy relies on that being non-NULL always.
2020-03-19 Jakub Jelinek <jakub@redhat.com>
PR c++/93931
* parser.c (cp_parser_omp_var_list_no_open): Call
process_outer_var_ref
on outer_automatic_var_p decls.
* cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also
for
capture proxy decls.
* testsuite/libgomp.c++/pr93931.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2020-04-07 19:03 ` cvs-commit at gcc dot gnu.org
@ 2020-09-17 14:25 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:15 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-17 14:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93931
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:4ef4c88af7007ff0563e65269e1807b1ba30085d
commit r8-10472-g4ef4c88af7007ff0563e65269e1807b1ba30085d
Author: Jakub Jelinek <jakub@redhat.com>
Date: Thu Mar 19 12:22:47 2020 +0100
c++: Fix up handling of captured vars in lambdas in OpenMP clauses
[PR93931]
Without the parser.c change we were ICEing on the testcase, because while
the
uses of the captured vars inside of the constructs were replaced with
capture
proxy decls, we didn't do that for decls in OpenMP clauses.
With that fixed, we don't ICE anymore, but the testcase is miscompiled and
FAILs
at runtime. This is because the capture proxy decls have DECL_VALUE_EXPR
and
during gimplification we were gimplifying those to their DECL_VALUE_EXPRs.
That is fine for shared vars, but for privatized ones we must not do that.
So that is what the cp-gimplify.c changes do. Had to add a DECL_CONTEXT
check
before calling is_capture_proxy because some VAR_DECLs don't have
DECL_CONTEXT
set (yet) and is_capture_proxy relies on that being non-NULL always.
2020-03-19 Jakub Jelinek <jakub@redhat.com>
PR c++/93931
* parser.c (cp_parser_omp_var_list_no_open): Call
process_outer_var_ref
on outer_automatic_var_p decls.
* cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also
for
capture proxy decls.
* testsuite/libgomp.c++/pr93931.C: New test.
(cherry picked from commit 484206967f958fc47827a71654fe52a98adc95cb)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2020-09-17 14:25 ` cvs-commit at gcc dot gnu.org
@ 2020-09-17 17:15 ` jakub at gcc dot gnu.org
2021-10-01 7:13 ` pinskia at gcc dot gnu.org
2021-10-01 7:14 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-17 17:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93931
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 8.5 and 9.4+ too.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2020-09-17 17:15 ` jakub at gcc dot gnu.org
@ 2021-10-01 7:13 ` pinskia at gcc dot gnu.org
2021-10-01 7:14 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-01 7:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93931
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |8.4.0, 9.3.0
Target Milestone|--- |8.5
Known to work| |10.1.0, 8.5.0, 9.4.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2021-10-01 7:13 ` pinskia at gcc dot gnu.org
@ 2021-10-01 7:14 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-01 7:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93931
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fytch at protonmail dot com
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 95028 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-10-01 7:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-93931-4@http.gcc.gnu.org/bugzilla/>
2020-03-18 17:56 ` [Bug c++/93931] ICE using lambda capture in openMP parallel for reduction jakub at gcc dot gnu.org
2020-03-18 18:51 ` jakub at gcc dot gnu.org
2020-03-19 11:28 ` cvs-commit at gcc dot gnu.org
2020-03-19 12:05 ` jakub at gcc dot gnu.org
2020-04-07 19:03 ` cvs-commit at gcc dot gnu.org
2020-09-17 14:25 ` cvs-commit at gcc dot gnu.org
2020-09-17 17:15 ` jakub at gcc dot gnu.org
2021-10-01 7:13 ` pinskia at gcc dot gnu.org
2021-10-01 7:14 ` pinskia at gcc dot gnu.org
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).