From 641f1ab4ed20677f2c9515bb039d8263a463576f Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Mon, 14 Sep 2015 12:05:58 +0000 Subject: [PATCH] re PR middle-end/67401 (Incorrect expand of __atomic_compare_exchange_8 using __sync_val_compare_and_swap_8) PR middle-end/67401 * optabs.c (expand_atomic_compare_and_swap): Move result of emitting sync_compare_and_swap_optab libcall to target_oval. From-SVN: r227746 --- gcc/ChangeLog | 6 ++++++ gcc/optabs.c | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 462a9977071..d5ef728f9e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-09-14 John David Anglin + + PR middle-end/67401 + * optabs.c (expand_atomic_compare_and_swap): Move result of emitting + sync_compare_and_swap_optab libcall to target_oval. + 2015-09-14 Marek Polacek * rtlanal.c (split_double): Cast to unsigned when shifting a negative diff --git a/gcc/optabs.c b/gcc/optabs.c index 79c6f06b991..c2a9b1ce9ef 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -7521,9 +7521,10 @@ expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval, if (libfunc != NULL) { rtx addr = convert_memory_address (ptr_mode, XEXP (mem, 0)); - target_oval = emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL, - mode, 3, addr, ptr_mode, - expected, mode, desired, mode); + rtx target = emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL, + mode, 3, addr, ptr_mode, + expected, mode, desired, mode); + emit_move_insn (target_oval, target); /* Compute the boolean return value only if requested. */ if (ptarget_bool) -- 2.30.2