http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60539
Bug ID: 60539 Summary: [SH] builtin string functions ignore loop and label alignment Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org CC: christian.bruel at st dot com Target: sh*-*-* The following function: unsigned int test (const char* x) { return __builtin_strlen (x); } compiled with -m4 -O2: mov r4,r0 tst #3,r0 bf/s .L14 mov r4,r1 mov #0,r3 .L12: mov.l @r1+,r2 cmp/str r3,r2 bf .L12 add #-4,r1 .L14: mov.b @r1+,r2 tst r2,r2 bf/s .L14 mov r1,r0 rts subc r4,r0 The loop and label alignments are missing. E.g. when not optimizing for size, the loop alignment is set to '4 bytes' (.align 2), which seems to be ignored by the code that expands the builtin functions.