https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
--- Comment #32 from deller at gmx dot de ---
Fixed in Linux kernel by declaring the extern int32 as char:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c42813b71a06a2ff4a155aa87ac609feeab76cf3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
--- Comment #31 from deller at gmx dot de ---
Richard suggested that adding a compiler optimization barrier (__asm__ ("" :
"+r" (__pptr))) might fix the problem.
I tested the attached patch and it works nicely.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
--- Comment #30 from deller at gmx dot de ---
Created attachment 51405
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51405&action=edit
Linux kernel patch to add compiler optimization barrier
Linux kernel boots sucessfully with this patch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
--- Comment #28 from deller at gmx dot de ---
Arnd,
there are various calls to the get_unaligned_X() functions in all kernel
bootloaders, specifically in the kernel decompression routines:
[deller@ls3530 linux-2.6]$ grep get_unaligned lib/decomp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
--- Comment #9 from deller at gmx dot de ---
On 9/1/21 11:25 PM, deller at gmx dot de wrote:
> The "ldh" loads only the first two bytes, and extends it into the upper 32bits
> with "extrw,s".
> So, only 16bits instead of 32bits are loaded from th
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
--- Comment #8 from deller at gmx dot de ---
On 9/1/21 11:19 PM, dave.anglin at bell dot net wrote:
>> I think the problem with your testcase is, that the compiler doesn't know the
>> alignment of the parameter "p" in your f_unaligned() function.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
--- Comment #6 from deller at gmx dot de ---
> So, it seems the __aligned__ attribute is ignored:
> extern u32 output_len __attribute__((__aligned__(1)));
I think the aligned attribute is not relevant here. Even
u32 output_len;
will gene
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102162
--- Comment #3 from deller at gmx dot de ---
Hi Arnd,
I think the problem with your testcase is, that the compiler doesn't know the
alignment of the parameter "p" in your f_unaligned() function.
So it will generate byte-accesses.
If you modify