diff options
-rw-r--r-- | expand.c | 10 | ||||
-rw-r--r-- | validation/expand/cost-deref-nested.c | 1 |
2 files changed, 5 insertions, 6 deletions
@@ -737,12 +737,12 @@ static int expand_dereference(struct expression *expr) * Is it "symbol" or "symbol + offset"? */ offset = 0; - if (unop->type == EXPR_BINOP && unop->op == '+') { + while (unop->type == EXPR_BINOP && unop->op == '+') { struct expression *right = unop->right; - if (right->type == EXPR_VALUE) { - offset = right->value; - unop = unop->left; - } + if (right->type != EXPR_VALUE) + break; + offset += right->value; + unop = unop->left; } if (unop->type == EXPR_SYMBOL) { diff --git a/validation/expand/cost-deref-nested.c b/validation/expand/cost-deref-nested.c index b09602b6..d6b62396 100644 --- a/validation/expand/cost-deref-nested.c +++ b/validation/expand/cost-deref-nested.c @@ -14,7 +14,6 @@ static int foo(int c) /* * check-name: cost-deref-nested * check-command: test-linearize -fdump-ir $file - * check-known-to-fail * * check-output-ignore * check-output-excludes: cbr |