[Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
mhiramat at redhat dot com
sourceware-bugzilla@sourceware.org
Thu May 1 00:06:00 GMT 2008
------- Additional Comments From mhiramat at redhat dot com 2008-04-30 21:19 -------
(In reply to comment #6)
> > > I think that the memcpys are assuming little-endian layout...
> >
> > Really? as far as I know, memcpy() is defined on each architecture. So I think
> > it can work correctly on those machines.
>
> I mean the way we're calling memcpy with &num. For size=8 this is ok, but on
> smaller sizes I think this will fail. On a big-endian machine, this will copy
> the most-significant bytes instead of the least. That's a much different result
> than casting an uint64_t to a smaller size.
Oh, I got it.
num(=0x12345678) contains data as:
Little-endian:
[8][7][6][5][4][3][2][1]
Big-endian:
[1][2][3][4][5][6][7][8]
on memory. thus we have to add some offsets on big-endian system when copying it.
Thanks,
--
http://sourceware.org/bugzilla/show_bug.cgi?id=5648
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Systemtap
mailing list