small bug fix for atomic compare and swap

Message ID
State New
Headers show

Commit Message

Mike Stump Jan. 23, 2013, 9:10 p.m.
The problem is that expansion can use const0_rtx as an indicator that we are not interested in the value.  This is an invalid as a target of a move, so, we must always have a valid target.  This dummies up a target, just like in the NULL_RTX case.



diff --git a/gcc/optabs.c b/gcc/optabs.c
index 353727f..a091deb 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7174,6 +7174,8 @@  expand_atomic_test_and_set (rtx target, rtx mem, enum memmodel model)
       trueval = const1_rtx;
       subtarget = target ? target : gen_reg_rtx (mode);
+      if (subtarget == const0_rtx)
+       subtarget = gen_reg_rtx (mode);