https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70857
--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> --- This bug is a consequence of false sharing of a RESULT_DECL between the CPU-intended OpenMP outlined function and the HSA-intended outlined (kernel) one. How come -fopenacc is necessary to trigger it, I don't know but the following patch fixes it. I need to bring my various branches up to speed for proper testing before I send it to the mailing list. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index c9600fb..a11f44b 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -13681,6 +13681,9 @@ grid_expand_target_grid_body (struct omp_region *target) tree new_parm_decl = copy_node (DECL_ARGUMENTS (kern_fndecl)); DECL_CONTEXT (new_parm_decl) = kern_fndecl; DECL_ARGUMENTS (kern_fndecl) = new_parm_decl; + gcc_assert (VOID_TYPE_P (TREE_TYPE (DECL_RESULT (kern_fndecl)))); + DECL_RESULT (kern_fndecl) = copy_node (DECL_RESULT (kern_fndecl)); + DECL_CONTEXT (DECL_RESULT (kern_fndecl)) = kern_fndecl; struct function *kern_cfun = DECL_STRUCT_FUNCTION (kern_fndecl); kern_cfun->curr_properties = cfun->curr_properties;