From: rth Date: Sun, 27 Nov 2011 00:10:18 +0000 (+0000) Subject: Fix expand_atomic_fetch_op wrt unused_result. X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=9ecf2034c5df867a6afc537b8a9eff885be871de;hp=7714437843c404635cc4c018baba428d777987f6 Fix expand_atomic_fetch_op wrt unused_result. * optabs.c (expand_atomic_fetch_op): Always return result. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181750 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 41b3b9b4d40..c16f1d8db58 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,7 @@ 2011-11-26 Richard Henderson + * optabs.c (expand_atomic_fetch_op): Always return result. + * optabs.c (init_sync_libfuncs_1): Include max in iteration. * omp-low.c (expand_omp_atomic): Assume anything aligned to diff --git a/gcc/optabs.c b/gcc/optabs.c index 0ce21e9b548..a1917cc3220 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -8068,7 +8068,7 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code, { /* If the result isn't used, no need to do compensation code. */ if (unused_result) - return target; + return result; /* Issue compensation code. Fetch_after == fetch_before OP val. Fetch_before == after REVERSE_OP val. */ @@ -8110,9 +8110,7 @@ expand_atomic_fetch_op (rtx target, rtx mem, rtx val, enum rtx_code code, result = emit_library_call_value (libfunc, NULL, LCT_NORMAL, mode, 2, addr, ptr_mode, val, mode); - if (unused_result) - return target; - if (fixup) + if (!unused_result && fixup) result = expand_simple_binop (mode, code, result, val, target, true, OPTAB_LIB_WIDEN); return result;