This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
- From: "mhiramat at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sources dot redhat dot com
- Date: 30 Apr 2008 21:19:12 -0000
- Subject: [Bug runtime/5648] Unaligned access to memory in _stp_vsnprintf() on ia64
- References: <20080119000650.5648.mhiramat@redhat.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- 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.