------- Comment #4 from kkojima at gcc dot gnu dot org 2009-05-13 14:07 ------- Created an attachment (id=17857) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17857&action=view) a test case
I've got a small test case from libiberty/concat.c. With -O1, 4.3 compiles vconcat_length to the codes below: ... .L5: jsr @r12 ! Call strlen nop add r0,r9 mov.l @r8,r4 mov r4,r2 add #4,r2 mov.l @(4,r8),r1 cmp/hs r2,r1 bt/s .L4 mov r8,r2 mov.l @(16,r8),r4 mov r13,r2 .L4: mov r4,r1 add #4,r1 mov.l r1,@r2 mov.l @r4,r4 tst r4,r4 bf/s .L5 mov r9,r4 !!! mov.l .L17,r0 jsr @r0 ! Call malloc. ... i.e. the delayed branch optimization fills a delay slot with an inappropriate instruction at the line !!!. I've confirmed that the 4.4 compiler's output is similar and the outputs for 4.2 and 4.5 look correct even with -O. I have no idea for what is going on ATM, though. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105