[vox-tech] a "Bus Error" C++ issue, platform, compiler or STL?

Chanoch (Ken) Bloom kbloom at gmail.com
Tue Aug 24 19:25:14 PDT 2010


On Tue, 2010-08-24 at 22:17 -0400, Hai Yi wrote:
> Thanks Jeff and Bill.
> Jeff, how do you know that the value,0xba7bfff, is corrupted? Because
> it's only 3.5 bytes? Could it be possible a value with zero stripped?
> Also, what's the mapping of the argument list b/w the code and that in
> the stack?

Because it's odd. Or more accurately, because it's not a multiple of 4.
Many processors (x86 and amd64 not included) require that memory access
be word-aligned. On a 32-bit machine, that means every 4 bytes. So every
pointer needs to be a multiple of 4 (unless it's being used with special
slower instructions) or a SIGBUS will result.

(x86 and amd64 are special -- they just do the slower access using the
same instructions as you use for word-aligned accesses.)

--Ken


More information about the vox-tech mailing list