https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106818
--- Comment #5 from baoshan <pangbw at gmail dot com> --- Per Andrew's request: For GCC built for RISC-V, With the following code: struct sss_t { int i; int j; } sss; extern char array[sizeof(struct sss_t )]; void foo() { struct sss_t *p = (struct sss_t *)array; p->i = 10; } The following asm is generated: foo(): lui a5,%hi(array) li a4,10 sb a4,%lo(array)(a5) sb zero,%lo(array+1)(a5) sb zero,%lo(array+2)(a5) sb zero,%lo(array+3)(a5) ret sss: .zero 8 While if remove the 'extern' from the C code, the following asm is generated: foo(): lui a5,%hi(array) li a4,10 sw a4,%lo(array)(a5) ret array: .zero 8 sss: .zero 8