https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80902

--- Comment #1 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Fri Jun 23 17:37:27 2017
New Revision: 249603

URL: https://gcc.gnu.org/viewcvs?rev=249603&root=gcc&view=rev
Log:
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.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c

Reply via email to