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

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-02-20
     Ever confirmed|0                           |1

--- Comment #15 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Compiling attachment 47879 with regular sh-elf cross compiler:

sh-elf-gcc -c -O2 -save-temps -dp string_coderange_scan.c 

and looking at the generated assembly, clearly shows the bug right before the
2nd casesi_worker_1 insn:


.L48:
        mov.l   .L120,r0        ! 11    [c=10 l=2]  movsi_i/0
        add     #8,r15          ! 1214  [c=4 l=2]  *addsi3/0
        lds.l   @r15+,pr        ! 1216  [c=1 l=2]  movsi_i/14
        mov.l   @r15+,r14       ! 1217  [c=1 l=2]  movsi_i/5
        mov.l   @r15+,r13       ! 1218  [c=1 l=2]  movsi_i/5
        mov.l   @r15+,r12       ! 1219  [c=1 l=2]  movsi_i/5
        mov.l   @r15+,r11       ! 1220  [c=1 l=2]  movsi_i/5
        mov.l   @r15+,r10       ! 1221  [c=1 l=2]  movsi_i/5
        mov.l   @r15+,r9        ! 1222  [c=1 l=2]  movsi_i/5
        rts                     ! 1225  [c=0 l=2]  *return_i
        mov.l   @r15+,r8        ! 1223  [c=1 l=2]  movsi_i/5
        .align 1
.L96:
        sub     r2,r10          ! 278   [c=4 l=2]  *subsi3_internal
        mov     #3,r2           ! 282   [c=4 l=2]  movsi_i/2


.L11:                           ! <<<< jump target BEFORE the constant pool
.L121:
        .align 2
.L120:
        .long   1048576         ! <<<< this is a constant in the constant pool
        .align 1
.L58:
        mov     r13,r3          ! 1119  [c=4 l=2]  movsi_i/1
        bra     .L15            ! 1261  [c=5 l=2]  jump_compact
        add     #-16,r3         ! 1120  [c=4 l=2]  *addsi3/0
        .align 1
.L29:
        mov.b   @(14,r3),r0     ! 316   [c=2 l=2] 
*extendqisi2_compact_mem_disp/0
        cmp/pz  r0              ! 317   [c=4 l=2]  cmpgesi_t/0
        bf      .L107           ! 318   [c=17 l=2]  *cbranch_t
.L30:
        mov.b   @(15,r3),r0     ! 330   [c=2 l=2] 
*extendqisi2_compact_mem_disp/0
        cmp/pz  r0              ! 331   [c=4 l=2]  cmpgesi_t/0
        bt      .L48            ! 332   [c=17 l=2]  *cbranch_t
        mov     r13,r8          ! 1068  [c=4 l=2]  movsi_i/1
        bra     .L23            ! 1265  [c=5 l=2]  jump_compact
        add     #-1,r8          ! 334   [c=4 l=2]  *addsi3/0
        .align 1
.L101:
        sub     r3,r1           ! 465   [c=4 l=2]  *subsi3_internal
        mov     r1,r3           ! 1083  [c=4 l=2]  movsi_i/1
.L33:
        mov     #3,r7           ! 469   [c=4 l=2]  movsi_i/2
        cmp/hi  r7,r3           ! 474   [c=4 l=2]  cmpgtusi_t
.L153:
        bt      .L11            ! 475   [c=17 l=2]  *cbranch_t <<< bad jump
        mova    .L42,r0         ! 1085  [c=9 l=2]  mova
        add     r3,r3           ! 1086  [c=9 l=4]  casesi_worker_1/0
        mov.w   @(r0,r3),r3
        add     r0,r3           ! 1087  [c=4 l=2]  *addsi3/0
        jmp     @r3
        nop                     ! 477   [c=4 l=4]  casesi_jump_1
        .align 2

Reply via email to