[Bug target/107339] RISC V -mstrict-align

yy172179 at 163 dot com gcc-bugzilla@gcc.gnu.org
Fri Oct 21 07:23:12 GMT 2022


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

--- Comment #4 from yy <yy172179 at 163 dot com> ---
It works to use "uint32_t_ua", but it still works to use "uint32_t" and just
change the function parameter from the structure pointer to the structure. "The
following is the assembly code
    0:   00154703                lbu     a4,1(a0)
 4:   00054783                lbu     a5,0(a0)
 8:   00354583                lbu     a1,3(a0)
 c:   0722                    slli    a4,a4,0x8
 e:   8f5d                    or      a4,a4,a5
10:   00254783                lbu     a5,2(a0)
14:   1141                    addi    sp,sp,-16
16:   c226                    sw      s1,4(sp)
18:   07c2                    slli    a5,a5,0x10
1a:   8fd9                    or      a5,a5,a4
1c:   000004b7                lui     s1,0x0
20:   05e2                    slli    a1,a1,0x18
22:   c422                    sw      s0,8(sp)
24:   8ddd                    or      a1,a1,a5
26:   842a                    mv      s0,a0
28:   00048513                mv      a0,s1
2c:   c606                    sw      ra,12(sp)
2e:   00000097                auipc   ra,0x0
32:   000080e7                jalr    ra # 2e <tttt+0x2e>
36:   00244703                lbu     a4,2(s0)
3a:   00144783                lbu     a5,1(s0)
3e:   00444583                lbu     a1,4(s0)
42:   0722                    slli    a4,a4,0x8
44:   8f5d                    or      a4,a4,a5
46:   00344783                lbu     a5,3(s0)
4a:   05e2                    slli    a1,a1,0x18
4c:   00048513                mv      a0,s1
50:   07c2                    slli    a5,a5,0x10
52:   8fd9                    or      a5,a5,a4
54:   8ddd                    or      a1,a1,a5
56:   00000097                auipc   ra,0x0
5a:   000080e7                jalr    ra # 56 <tttt+0x56>
5e:   00444703                lbu     a4,4(s0)
62:   00344783                lbu     a5,3(s0)
66:   00644583                lbu     a1,6(s0)
6a:   0722                    slli    a4,a4,0x8
6c:   8f5d                    or      a4,a4,a5
6e:   00544783                lbu     a5,5(s0)
72:   4422                    lw      s0,8(sp)
74:   40b2                    lw      ra,12(sp)
76:   07c2                    slli    a5,a5,0x10
78:   00048513                mv      a0,s1
7c:   4492                    lw      s1,4(sp)
7e:   8fd9                    or      a5,a5,a4
80:   05e2                    slli    a1,a1,0x18
82:   8ddd                    or      a1,a1,a5
84:   0141                    addi    sp,sp,16
86:   00000317                auipc   t1,0x0
8a:   00030067                jr      t1 # 86 <tttt+0x86>


More information about the Gcc-bugs mailing list