DECL_SAVED_TREE (fndecl) = NULL_TREE;
/* If we had callee-copies statements, insert them at the beginning
- of the function and clear DECL_VALUE_EXPR_P on the parameters. */
+ of the function and clear DECL_HAS_VALUE_EXPR_P on the parameters. */
if (!gimple_seq_empty_p (parm_stmts))
{
tree parm;
/* Callback for walk_gimple_stmt used to scan for link var operands. */
static tree
-find_link_var_op (tree *tp, int *walk_subtrees, void *)
+process_link_var_op (tree *tp, int *walk_subtrees, void *data)
{
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
tree t = *tp;
if (VAR_P (t)
&& is_global_var (t)
&& lookup_attribute ("omp declare target link", DECL_ATTRIBUTES (t)))
{
+ wi->info = *tp = unshare_expr (DECL_VALUE_EXPR (t));
*walk_subtrees = 0;
- return t;
+ return NULL_TREE;
}
return NULL_TREE;
gimple_call_set_arg (gsi_stmt (gsi), 1, null_pointer_node);
update_stmt (gsi_stmt (gsi));
}
- if (walk_gimple_stmt (&gsi, NULL, find_link_var_op, NULL))
+ struct walk_stmt_info wi;
+ memset (&wi, 0, sizeof (wi));
+ walk_gimple_stmt (&gsi, NULL, process_link_var_op, &wi);
+ if (wi.info)
gimple_regimplify_operands (gsi_stmt (gsi), &gsi);
}
}
! { dg-additional-options "-Wall" }
+
! PR fortran/115559
+! PR middle-end/115637
module m
integer :: A
!$omp target map(from:res)
res = run_device1()
!$omp end target
- print *, res
- ! FIXME: arr2 not link mapped -> PR115637
- ! if (res /= -11436) stop 5
- if (res /= -11546) stop 5 ! FIXME
+ ! print *, res
+ if (res /= -11436) stop 5
end
integer function run_device1()
!$omp declare target
integer :: i
run_device1 = -99
- ! FIXME: arr2 not link mapped -> PR115637
- ! arr2 = [11,22,33,44]
+ arr2 = [11,22,33,44]
if (any (arr(10:50) /= [(i, i=10,50)])) then
run_device1 = arr(11)
return
end if
- ! FIXME: -> PR115637
- ! run_device1 = sum(arr(10:13) + arr2)
- run_device1 = sum(arr(10:13) ) ! FIXME
+ run_device1 = sum(arr(10:13) + arr2)
do i = 10, 50
arr(i) = 3 - 10 * arr(i)
end do