aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 36a1879..9339b5f 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -452,6 +452,14 @@ ST_FUNC void vswap(void)
{
SValue tmp;
+ /* cannot let cpu flags if other instruction are generated. Also
+ avoid leaving VT_JMP anywhere except on the top of the stack
+ because it would complicate the code generator. */
+ if (vtop >= vstack) {
+ int v = vtop->r & VT_VALMASK;
+ if (v == VT_CMP || (v & ~1) == VT_JMP)
+ gv(RC_INT);
+ }
tmp = vtop[0];
vtop[0] = vtop[-1];
vtop[-1] = tmp;