This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/14240] New: crossjumping deletes jump table


While trying to add POWER5 scheduling support to GCC, I am encountering 
what appears to be a bug with crossjumping.  If I disable crossjumping, the 
problem does not occur.  The bug occurs when compiling
insn-attrtab.c:insn_latency().  The resulting assembly code fragment with
the failure looks like the following:

LC..218:
        .tc L..8258[TC],L..8258
LC..219:
        .tc L..8266[TC],L..8266
L..8258:
L..8259:
        addi 0,10,-272
        cmplwi 7,0,4
        bgt- 7,L..8215
        lwz 11,LC..219(2)       # label L..8266
L..8301:
        slwi 0,0,2
        lwzx 9,11,0
        add 9,9,11
        mtctr 9
        bctr
        .align 2
        .align 2
L..8266:
        .long L..8265-L..8266
        .long L..8265-L..8266
        .long L..8265-L..8266
        .long L..8265-L..8266
        .long L..8265-L..8266
L..8251:
        addi 0,10,-272
        cmplwi 7,0,4
        bgt- 7,L..8215
        lwz 11,LC..218(2)       # label L..8258
        b L..8301

The code is performing a tablejump.  The failure path starts at the bottom, 
loading the address of label L..8258 into %r11, then branching to L..8301, 
introduced by crossjumping, which performs the remainder of the tablejump 
code.  The problem is that %r11 should be loaded with a label corresponding to 
the base of a jump table, like L..8266 in the straightline codepath from the 
top.  When the code loads the value from the jump table that should be a 
difference of two labels, it instead loads the hex value of a PowerPC 
instruction at L..8258, which is a large number, adds that to the base address, 
and jumps to an illegal address.

        It looks like a jump table that should be located at L..8258 was
deleted.

-- 
           Summary: crossjumping deletes jump table
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dje at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powrepc-ibm-aix5.2.0.0
  GCC host triplet: powerpc-ibm-aix5.2.0.0
GCC target triplet: powerpc-ibm-aix5.2.0.0


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]