summaryrefslogtreecommitdiff
path: root/gas/expr.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-10-20 11:12:46 +1030
committerAlan Modra <amodra@gmail.com>2018-10-20 19:46:43 +1030
commite4c2619ad1f31cf73d275b027e8c0cf9c6e9597a (patch)
tree1b93a048c0c8e91a12c2841df06446689da1c61d /gas/expr.c
parentac85e67c053f1555def2c111962f4e68740794f9 (diff)
downloadbinutils-gdb-e4c2619ad1f31cf73d275b027e8c0cf9c6e9597a.tar.gz
PR23800, .eqv doesn't always defer expression evaluation
.eqv (and ==) ought not simplify expressions involving dot or other symbols set by .eqv. If such simplification occurs, the value of dot will be that at the assignment rather than at the place where the symbol is used. PR 23800 * expr.c (expr): Don't simplify expressions involving forward_ref symbols when mode is expr_defer. * config/tc-spu.c (spu_cons): Parse expression using normal expression evaluation if @ppu is not detected. * testsuite/gas/all/eqv-dot.d, * testsuite/gas/all/eqv-dot.s: New test. * testsuite/gas/all/gas.exp: Run it.
Diffstat (limited to 'gas/expr.c')
-rw-r--r--gas/expr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gas/expr.c b/gas/expr.c
index 074e0b3f0b5..bacfa4e9e82 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -1838,6 +1838,13 @@ expr (int rankarg, /* Larger # is higher rank. */
right.X_op_symbol = NULL;
}
+ if (mode == expr_defer
+ && ((resultP->X_add_symbol != NULL
+ && S_IS_FORWARD_REF (resultP->X_add_symbol))
+ || (right.X_add_symbol != NULL
+ && S_IS_FORWARD_REF (right.X_add_symbol))))
+ goto general;
+
/* Optimize common cases. */
#ifdef md_optimize_expr
if (md_optimize_expr (resultP, op_left, &right))