Re: ICE: SEGFAULT in mem rtx - GCC-4.5.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/22/2015 11:54 PM, vikram1729 wrote:
Hi
I am building gcc-4.5.1 cross compiler. I am getting SEGFAULT ICE at
simplify-rtx.c:167, i.e. at this function

/* If X is a MEM referencing the constant pool, return the real value.
     Otherwise return X.  */
rtx
avoid_constant_pool_reference (rtx x)
{
    rtx c, tmp, addr;
    ....
    ....
-->   addr = targetm.delegitimize_address (addr); //SEGFAULT here
    /* Split the address into a base and integer offset.  */
    if (GET_CODE (addr) == CONST
    ....
}

When debugging, call debug_rtx(x) gives this pattern:
(mem/c/i:SI (plus:SI (reg/f:SI 129 virtual-stack-vars)
         (const_int -8 [0xfffffff8])) [0 __ul+0 S4 A32])

To solve it, I tried to implement my own delegitimize function:
static rtx
target_delegitimize_address (rtx orig_x)
{
    //rtx x = orig_x;
    rtx x = delegitimize_mem_from_attrs (orig_x);

    if (GET_CODE (x) != MEM)
      return XEXP(x, 0);

    x = XEXP (x, 0);
    if (GET_CODE (x) == PLUS
           && GET_CODE (XEXP (x, 1)) == CONST_INT
           && GET_CODE (XEXP (x, 0)) == REG)
      //DON'T KNOW WHAT TO WRITE HERE. Tried this but failed: return XVECEXP
(XEXP(x, 1), 0, 0);

   return orig_x;
}

Is it a backend problem?
This is most definitely a problem with your target files.

You certainly don't want to be returning XVECEXP (anything) since you don't have a vector type.

In fact, for (plus (virtual-stack-vars) (const_int)), I'd think you'd want to return the address as-is.

The delegitimize_address look, to the best of my knowledge, is primarily supposed to be dealing with embedded UNSPECs or other obfuscated RTL for PIC support and the like. A simple base+offset address shouldn't need delegitimization.

jeff




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux