path: root/tcg/tcg.c
diff options
authorStefan Weil <sw@weilnetz.de>2012-03-10 19:59:04 +0100
committerBlue Swirl <blauwirbel@gmail.com>2012-03-11 11:28:39 +0000
commit9d6fca70c771ac50a641aa2558e3a19c4e2b09b8 (patch)
treed5ad62768c9a4d059113db2a419bac0e6695c241 /tcg/tcg.c
parentf7cf5d5b7175ee8ee26a90cdbfbb9d5ccc560416 (diff)
tcg: Improve tcg_out_label and fix its usage for w64
tcg_out_label is always called with a third argument of pointer type which was casted to tcg_target_long. These casts can be avoided by changing the prototype of tcg_out_label. There was also a cast to long. For most hosts with sizeof(long) == sizeof(tcg_target_long) == sizeof(void *) this did not matter, but for w64 it was wrong. This is fixed now. Cc: Blue Swirl <blauwirbel@gmail.com> Cc: Richard Henderson <rth@twiddle.net> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'tcg/tcg.c')
1 files changed, 3 insertions, 3 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index cd2db3cb50..531db55f5d 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -128,11 +128,11 @@ static void tcg_out_reloc(TCGContext *s, uint8_t *code_ptr, int type,
-static void tcg_out_label(TCGContext *s, int label_index,
- tcg_target_long value)
+static void tcg_out_label(TCGContext *s, int label_index, void *ptr)
TCGLabel *l;
TCGRelocation *r;
+ tcg_target_long value = (tcg_target_long)ptr;
l = &s->labels[label_index];
if (l->has_value)
@@ -2123,7 +2123,7 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,
case INDEX_op_set_label:
tcg_reg_alloc_bb_end(s, s->reserved_regs);
- tcg_out_label(s, args[0], (long)s->code_ptr);
+ tcg_out_label(s, args[0], s->code_ptr);
case INDEX_op_call:
dead_args = s->op_dead_args[op_index];