[Bug target/100163] -falign-loops sometimes produces invalid code for SH-2

2021-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100163

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|WAITING |RESOLVED

--- Comment #3 from Andrew Pinski  ---
Yes this is not a bug.  You can't use .align in the data section and expect
nops to happen.  You marking a function in the data section makes this invalid.

See
https://sourceware.org/binutils/docs-2.36/as/Align.html#Align
"However, on most systems, if the section is marked as containing code and the
fill value is omitted, the space is filled with no-op instructions."

GCC is assuming you are using a section which is marked as containing code
which .data is not one of those sections.

[Bug target/100163] -falign-loops sometimes produces invalid code for SH-2

2021-04-20 Thread vluchits at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100163

--- Comment #2 from Victor Luchitz  ---
Here's relevant -S output for -O2:
...
sub r1,r15
.align 2
.L186:
mov.w   @r2,r0
extu.w  r0,r4

And for -O2 -fno-align-loops:
...
sub r1,r15
.L186:
mov.w   @r2,r0
extu.w  r0,r4

I'm not sure what's workarounds are available for an end user here other than
to explicitly disable all kinds of alignments.

[Bug target/100163] -falign-loops sometimes produces invalid code for SH-2

2021-04-20 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100163

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
 Ever confirmed|0   |1
   Last reconfirmed||2021-04-20

--- Comment #1 from Andrew Pinski  ---
>relocating functions to .data segment

This is more likely an assembly issue or rather an user issue.
.align inside the text section uses nops but inside non-text sections uses 0s.
What does GCC output -S show?