'perl-5.10.0' build with gcc-4.3.[234] segfaults due to wrong code.

Reproduce with cross compiler : sh-linux-gcc -m4 -O2 -g -fPIC -S perl.i

Problematic part of generated code is as follows.
(segfaults at source line 5182.)

        .loc 1 5179 0
        mov.l   @(32,r14),r0      <-- r0 is loaded here 
.L2504:
        mov.w   .L2314,r3
        add     r0,r3
        mov.l   @(24,r3),r1
        mov.l   r1,@(28,r3)
        .loc 1 5180 0
        mov.w   .L2315,r1
        add     r0,r1
        .loc 1 5181 0
        mov.w   .L2316,r0        <-- r0 is clobberd
        .loc 1 5180 0
        mov.l   r1,@(36,r3)
        .loc 1 5181 0
        mov.l   @(36,r3),r2
        mov.l   @(r0,r14),r1
        mov.l   r1,@(20,r2)
        .loc 1 5182 0
        mov.w   .L2317,r1
        mov.l   @(r0,r1),r0     <-- segfaults here (wrong r0)
        and     #4,r0
        tst     r0,r0


-- 
           Summary: [4.3 regression] SH: miscompile with -O2 -fPIC
           Product: gcc
           Version: 4.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sugioka at itonet dot co dot jp
 GCC build triplet: sh4-unknown-linux-gnu
  GCC host triplet: sh4-unknown-linux-gnu
GCC target triplet: sh4-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40301

Reply via email to