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

2022-10-21 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107339 --- Comment #5 from Andrew Pinski --- That is because with the non pointer case gcc can figure out the alignment without having to assume via pointers. Note the original code is also undefined by the c standard even the non pointer case you gav

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

2022-10-21 Thread yy172179 at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107339 --- Comment #4 from yy --- 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

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

2022-10-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107339 --- Comment #3 from Andrew Pinski --- Again, the problem is the access via uint32_t which says it is an aligned access. This is why you need uint32_t_ua there.

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

2022-10-20 Thread yy172179 at 163 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107339 --- Comment #2 from yy --- (In reply to Andrew Pinski from comment #1) > The code is broken. > > uint32_t here is aligned to 32bits and you access it via that type. > > > this is the correct fix: > > > typedef uint32_t uint32_t_ua __attribu

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

2022-10-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107339 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED