aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/builtins.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 130fa37..ff2c723 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-23 Segher Boessenkool <segher@kernel.crashing.org>
+
+ 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.
+
2017-06-23 Jeff Law <law@redhat.com>
* doc/contrib.texi: Add entry for Steven Pemberton's work on
diff --git a/gcc/builtins.c b/gcc/builtins.c
index ce657bf..7e829ef 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -6079,6 +6079,12 @@ expand_builtin_atomic_fetch_op (machine_mode mode, tree exp, rtx target,
gcc_assert (TREE_OPERAND (addr, 0) == fndecl);
TREE_OPERAND (addr, 0) = builtin_decl_explicit (ext_call);
+ /* If we will emit code after the call, the call can not be a tail call.
+ If it is emitted as a tail call, a barrier is emitted after it, and
+ then all trailing code is removed. */
+ if (!ignore)
+ CALL_EXPR_TAILCALL (exp) = 0;
+
/* Expand the call here so we can emit trailing code. */
ret = expand_call (exp, target, ignore);