diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-04-24 14:45:43 -0700 |
|---|---|---|
| committer | Josh Triplett <josh@freedesktop.org> | 2008-04-24 19:23:18 -0700 |
| commit | a0962f7893fe8c7ce36ce8b03952335cb5152b54 (patch) | |
| tree | 55cbabd8f2646321117716478190629b833f1c8d | |
| parent | 32dd96be4de207b09559d9b71c4cd6f7cb0cb4e2 (diff) | |
| download | sparse-dev-a0962f7893fe8c7ce36ce8b03952335cb5152b54.tar.gz | |
Fix cast instruction generation
Whether it's a sign-extending cast or not depends on the source
of the cast, not destination. The final size of the cast depends
on the destination, of course.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | linearize.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/linearize.c b/linearize.c index 45bb168a..ec48dac1 100644 --- a/linearize.c +++ b/linearize.c @@ -1097,10 +1097,10 @@ static pseudo_t linearize_postop(struct entrypoint *ep, struct expression *expr) * case, since you can't access through it anyway without another * cast. */ -static struct instruction *alloc_cast_instruction(struct symbol *ctype) +static struct instruction *alloc_cast_instruction(struct symbol *src, struct symbol *ctype) { int opcode = OP_CAST; - struct symbol *base = ctype; + struct symbol *base = src; if (base->ctype.modifiers & MOD_SIGNED) opcode = OP_SCAST; @@ -1127,7 +1127,7 @@ static pseudo_t cast_pseudo(struct entrypoint *ep, pseudo_t src, struct symbol * return VOID; if (from->bit_size < 0 || to->bit_size < 0) return VOID; - insn = alloc_cast_instruction(to); + insn = alloc_cast_instruction(from, to); result = alloc_pseudo(insn); insn->target = result; insn->orig_type = from; |
