public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/107236] New: [OpenMP] ICE for reverse offload: in expand_GOMP_TARGET_REV, at internal-fn.cc:376
@ 2022-10-12 13:35 burnus at gcc dot gnu.org
2022-10-12 13:47 ` [Bug middle-end/107236] " burnus at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-10-12 13:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107236
Bug ID: 107236
Summary: [OpenMP] ICE for reverse offload: in
expand_GOMP_TARGET_REV, at internal-fn.cc:376
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code, openmp
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
Created attachment 53696
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53696&action=edit
Testcase - compile as: gfortran -fopenmp test.f90
This only shows up if ENABLE_OFFLOADING is true during the GCC build.
The attached testcase fails with:
rev-test-ice.f90:5:33: internal compiler error: in expand_GOMP_TARGET_REV, at
internal-fn.cc:376
5 | !$omp target device(ancestor:1)
| ^
0x791309 expand_GOMP_TARGET_REV
/net/build1-fossa-cs/scratch/tburnus/fsf.mainline.x86_64-linux-gnu-amdgcn/src/gcc-mainline/gcc/internal-fn.cc:376
0xb2c147 expand_call_stmt
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/107236] [OpenMP] ICE for reverse offload: in expand_GOMP_TARGET_REV, at internal-fn.cc:376
2022-10-12 13:35 [Bug middle-end/107236] New: [OpenMP] ICE for reverse offload: in expand_GOMP_TARGET_REV, at internal-fn.cc:376 burnus at gcc dot gnu.org
@ 2022-10-12 13:47 ` burnus at gcc dot gnu.org
2022-10-24 13:20 ` cvs-commit at gcc dot gnu.org
2022-10-24 13:25 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-10-12 13:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107236
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The problem seems to be that:
execute_omp_device_lower ()
...
tree lhs = gimple_call_lhs (stmt), rhs = NULL_TREE;
tree type = lhs ? TREE_TYPE (lhs) : integer_type_node;
switch (gimple_call_internal_fn (stmt))
{
case IFN_GOMP_TARGET_REV:
is never reached.
Thus, IFN_GOMP_TARGET_REV remains - and the assert that IFN_GOMP_TARGET_REV has
been removed fails, leading to the ICE.
It seems as if pass_omp_device_lower::gate(...) wrongly skips the generated
nested
function for parallel. The current check is:
return (!(fun->curr_properties & PROP_gimple_lomp_dev)
|| (flag_openmp
&& cgraph_node::get (fun->decl)->calls_declare_variant_alt));
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/107236] [OpenMP] ICE for reverse offload: in expand_GOMP_TARGET_REV, at internal-fn.cc:376
2022-10-12 13:35 [Bug middle-end/107236] New: [OpenMP] ICE for reverse offload: in expand_GOMP_TARGET_REV, at internal-fn.cc:376 burnus at gcc dot gnu.org
2022-10-12 13:47 ` [Bug middle-end/107236] " burnus at gcc dot gnu.org
@ 2022-10-24 13:20 ` cvs-commit at gcc dot gnu.org
2022-10-24 13:25 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-10-24 13:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107236
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:
https://gcc.gnu.org/g:178ac530fe67e4f2fc439cc4ce89bc19d571ca31
commit r13-3455-g178ac530fe67e4f2fc439cc4ce89bc19d571ca31
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Mon Oct 24 15:19:00 2022 +0200
OpenMP: Fix reverse offload GOMP_TARGET_REV IFN corner cases [PR107236]
For 'target parallel' and similarly nested directives, cgraph_node's
calls_declare_variant_alt was not set in the parent region node but in
cfun->decl. Hence, pass_omp_device_lower did not process handle the
internal function GOMP_TARGET_REV. - Solution is to set it to the
DECL_CONTEXT, which is set in adjust_context_and_scope.
The cgraph_node::create_clone issue is exposed with -O2 for the existing
libgomp.fortran/reverse-offload-1.f90.
PR middle-end/107236
gcc/ChangeLog:
* omp-expand.cc (expand_omp_target): Set calls_declare_variant_alt
in DECL_CONTEXT and not to cfun->decl.
* cgraphclones.cc (cgraph_node::create_clone): Copy also the
node's calls_declare_variant_alt value.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/target-device-ancestor-6.f90: New test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/107236] [OpenMP] ICE for reverse offload: in expand_GOMP_TARGET_REV, at internal-fn.cc:376
2022-10-12 13:35 [Bug middle-end/107236] New: [OpenMP] ICE for reverse offload: in expand_GOMP_TARGET_REV, at internal-fn.cc:376 burnus at gcc dot gnu.org
2022-10-12 13:47 ` [Bug middle-end/107236] " burnus at gcc dot gnu.org
2022-10-24 13:20 ` cvs-commit at gcc dot gnu.org
@ 2022-10-24 13:25 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-10-24 13:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107236
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED on GCC 13/mainline.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-10-24 13:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-12 13:35 [Bug middle-end/107236] New: [OpenMP] ICE for reverse offload: in expand_GOMP_TARGET_REV, at internal-fn.cc:376 burnus at gcc dot gnu.org
2022-10-12 13:47 ` [Bug middle-end/107236] " burnus at gcc dot gnu.org
2022-10-24 13:20 ` cvs-commit at gcc dot gnu.org
2022-10-24 13:25 ` burnus 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).