]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/builtins.c
Fix expand_builtin_atomic_fetch_op for pre-op (PR80902)
authorsegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Jun 2017 17:37:27 +0000 (17:37 +0000)
committersegher <segher@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Jun 2017 17:37:27 +0000 (17:37 +0000)
commita2f95d97e23284d27c399aee1c60bf5496d0a256
tree89c7f9311baba6c0a9a0a452d30f482c63850b2a
parentfb68d1896602e102c32ccf00043112bec163815b
Fix expand_builtin_atomic_fetch_op for pre-op (PR80902)

__atomic_add_fetch adds a value to some memory, and returns the result.
If there is no direct support for this, expand_builtin_atomic_fetch_op
is asked to implement this as __atomic_fetch_add (which returns the
original value of the mem), followed by the addition.  Now, the
__atomic_add_fetch could have been a tail call, but we shouldn't
perform the __atomic_fetch_add as a tail call: following code would
not be executed, and in fact thrown away because there is a barrier
after tail calls.

This fixes it.

PR middle-end/80902
* builtins.c (expand_builtin_atomic_fetch_op): If emitting code after
a call, force the call to not be a tail call.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249603 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/builtins.c