https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111933

--- Comment #2 from Davide Bettio <bettio.davide at gmail dot com> ---
(In reply to Richard Biener from comment #1)
> uint32_t from_unaligned_u32(uint32_t *unaligned)
> {
>     uint32_t tmp;
>     tmp = *unaligned;
> 
> note this isn't an unaligned access since you dereference a uint32_t pointer

Let me explain better my purpose: I was writing a function for reading uint32_t
and uint64_t values at any address, including odd ones such as 0x00002345.

So as far as I know the only generic way to do this is either casting them to
uint8_t and reading them as 4 or 8 bytes, or using memcpy.
My expectation is that memcpy is always replaced with a load instruction when
fast unaligned memory access is available.

Let me know if I am making any wrong assumptiom.

Reply via email to