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

--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 65722
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65722&action=edit
pr126179-run.c: Runnable GNU-C99 test case

Here is a runnable test case that fails with -Os. It fails with GCC v15+.  In
older revisions, the loop is unrolled to

test:
        ldi r24,lo8(17)  ;  15  [c=4 l=1]  movqi_insn/1
        call write_data  ;  6   [c=0 l=2]  call_insn/1
        ldi r24,lo8(51)  ;  16  [c=4 l=1]  movqi_insn/1
        call write_cmd   ;  8   [c=0 l=2]  call_insn/1
        ldi r24,lo8(85)  ;  17  [c=4 l=1]  movqi_insn/1
        jmp write_data   ;  10  [c=0 l=2]  call_insn/3

That v15+ doesn't unroll it is an optimization flaw in its own right.

Reply via email to