diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2022-05-31 15:27:37 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2022-05-31 15:52:42 +0200 |
| commit | 187285b32ea71c25419a09724d9fe5f1b46aab2e (patch) | |
| tree | 4cc77121deaa91575ab75bb45a3635568f63cf71 /expand.c | |
| parent | 698360ca020e8ce4bc84eb44233dba9dbc9b598c (diff) | |
| download | sparse-dev-187285b32ea71c25419a09724d9fe5f1b46aab2e.tar.gz | |
cast_value: remove error-prone redundant argument
The last two arguments of cast_value() are the old expression and
the oldtype which suggest that this oldtype can be distinct from the
type of the old expression.
But this is not the case because internally the type used to retrieve
the value of the expression is the type of the expression itself (old->ctype)
the type which is used and the two types must be the same (or at least
be equivalent).
So, remove the error-prone last argument and always us the type of the
expression itself.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'expand.c')
| -rw-r--r-- | expand.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -94,9 +94,9 @@ static long long get_longlong(struct expression *expr) return (value & andmask) | ormask; } -void cast_value(struct expression *expr, struct symbol *newtype, - struct expression *old, struct symbol *oldtype) +void cast_value(struct expression *expr, struct symbol *newtype, struct expression *old) { + struct symbol *oldtype = old->ctype; int old_size = oldtype->bit_size; int new_size = newtype->bit_size; long long value, mask, signmask; @@ -876,7 +876,7 @@ static int expand_cast(struct expression *expr) /* Simplify normal integer casts.. */ if (target->type == EXPR_VALUE || target->type == EXPR_FVALUE) { - cast_value(expr, expr->ctype, target, target->ctype); + cast_value(expr, expr->ctype, target); return 0; } return cost + 1; |
