[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: How do I find/fix unaligned accesses?

Eric Ding wrote:
> thanks for the tips... ok, so now I'm looking at
>         unaligned trap at 0000015556b9d360: 0000000120d9740c 27 1
> and the variable being accessed is a double, which means it must be aligned
> on 4 byte boundaries, right?  But it's correct, then, isn't it?  That is,
> 0x0000000120d9740c is divisible by 4, so why is there still an error?

Doubles are 8 bytes.

I treat unaligned traps just like any memory error.  I usually find
access through a pointer that was never initialized, has been clobbered
by some other errant code, or has been overwritten because it was on the
heap but the structure it belonged to has been freed.  There are other
ways to get bad pointers, but I rarely find that the compiler generated
a bad pointer.

Dick Hadsell			914-381-8400 x5446 Fax: 914-381-9790
Reply-to:			hadsell@blueskystudios.com
Blue Sky | VIFX                 http://www.bluesky-vifx.com
1 South Road, Harrison, NY 10528

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []