diff options
author | Mike Pall <mike> | 2012-07-03 00:03:01 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-07-03 00:03:01 +0200 |
commit | 2df19049eff7ce246e9cea9eafb78d86a35cb845 (patch) | |
tree | c535c4727deae141a6ae727ab7710d96e12e4c76 /src | |
parent | 0af3f47ba01b9634f75a1aee38e318d74dab53d0 (diff) | |
download | luajit-2df19049eff7ce246e9cea9eafb78d86a35cb845.tar.gz luajit-2df19049eff7ce246e9cea9eafb78d86a35cb845.tar.bz2 luajit-2df19049eff7ce246e9cea9eafb78d86a35cb845.zip |
Avoid strict aliasing issues.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_snap.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lj_snap.c b/src/lj_snap.c index 1e6f10d0..bef7abc9 100644 --- a/src/lj_snap.c +++ b/src/lj_snap.c | |||
@@ -625,13 +625,13 @@ static void snap_restoredata(GCtrace *T, ExitState *ex, | |||
625 | IRIns *ir = &T->ir[ref]; | 625 | IRIns *ir = &T->ir[ref]; |
626 | RegSP rs = ir->prev; | 626 | RegSP rs = ir->prev; |
627 | int32_t *src; | 627 | int32_t *src; |
628 | union { uint64_t u64; float f; } tmp; | 628 | uint64_t tmp; |
629 | if (irref_isk(ref)) { | 629 | if (irref_isk(ref)) { |
630 | if (ir->o == IR_KNUM || ir->o == IR_KINT64) { | 630 | if (ir->o == IR_KNUM || ir->o == IR_KINT64) { |
631 | src = mref(ir->ptr, int32_t); | 631 | src = mref(ir->ptr, int32_t); |
632 | } else if (sz == 8) { | 632 | } else if (sz == 8) { |
633 | tmp.u64 = (uint64_t)(uint32_t)ir->i; | 633 | tmp = (uint64_t)(uint32_t)ir->i; |
634 | src = (int32_t *)&tmp.u64; | 634 | src = (int32_t *)&tmp; |
635 | } else { | 635 | } else { |
636 | src = &ir->i; | 636 | src = &ir->i; |
637 | } | 637 | } |
@@ -655,8 +655,8 @@ static void snap_restoredata(GCtrace *T, ExitState *ex, | |||
655 | src = (int32_t *)&ex->fpr[r-RID_MIN_FPR]; | 655 | src = (int32_t *)&ex->fpr[r-RID_MIN_FPR]; |
656 | #if LJ_TARGET_PPC | 656 | #if LJ_TARGET_PPC |
657 | if (sz == 4) { /* PPC FPRs are always doubles. */ | 657 | if (sz == 4) { /* PPC FPRs are always doubles. */ |
658 | tmp.f = (float)*(double *)src; | 658 | *(float *)dst = (float)*(double *)src; |
659 | src = (int32_t *)&tmp.f; | 659 | return; |
660 | } | 660 | } |
661 | #else | 661 | #else |
662 | if (LJ_BE && sz == 4) src++; | 662 | if (LJ_BE && sz == 4) src++; |