https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
Arnd Bergmann <arnd at linaro dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |arnd at linaro dot org
--- Comment #2 from Arnd Bergmann <arnd at linaro dot org> ---
I tried reproducing the issue with my original kernel code, using this input:
typedef unsigned u32;
#define __packed __attribute__((packed))
#define __get_unaligned_t(type, ptr) ({
\
const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr);
\
__pptr->x;
\
})
#define get_unaligned(ptr) __get_unaligned_t(typeof(*(ptr)), (ptr))
int f_unaligned(u32 *p)
{
return get_unaligned(p);
}
int g(u32 *p)
{
return *(p);
}
and it looks like I get correct output:
hppa64-linux-gcc -S kernel/test_unaligned.c -o - -O2
.LEVEL 2.0w
.text
.align 8
.globl f_unaligned
.type f_unaligned, @function
f_unaligned:
.PROC
.CALLINFO FRAME=0,NO_CALLS
.ENTRY
ldb 0(%r26),%r20
ldb 1(%r26),%r19
depd,z %r20,39,40,%r20
depd,z %r19,47,48,%r19
ldb 2(%r26),%r31
ldb 3(%r26),%r28
or %r19,%r20,%r19
depd,z %r31,55,56,%r31
or %r31,%r19,%r31
or %r28,%r31,%r28
bve (%r2)
extrd,s %r28,63,32,%r28
.EXIT
.PROCEND
.size f_unaligned, .-f_unaligned
.align 8
.globl g
.type g, @function
g:
.PROC
.CALLINFO FRAME=0,NO_CALLS
.ENTRY
ldw 0(%r26),%r28
bve (%r2)
extrd,s %r28,63,32,%r28
.EXIT
.PROCEND
.size g, .-g
.ident "GCC: (GNU) 11.1.0"
Any idea what the difference is between the working version and your broken
one?