[PATCH][rs6000] tighten checks before calling get_pool_constant

Steven Bosscher stevenb.gcc@gmail.com
Fri May 30 00:32:00 GMT 2008


Hi,

Without libcall notes we have failures on rs6000 that occur because
rs6000 accepts addresses for constant pool entries that the middle end
does not accept.

The failure occurs in rs6000_legitimize_reload_address which in the
patched compiler (no libcall notes) is at line 4192 and looks like:

 if (TARGET_TOC
    && constant_pool_expr_p (x)
    && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (x), mode))
  {
    x = create_TOC_reference (x);
    *win = 1;
    return x;
  }

The problem is that that rs6000.c:constant_pool_expr_p() is much more
general than varasm.c:get_constant_pool(). Consider:

(gdb) p debug_rtx (addr)
(const:DI (plus:DI (symbol_ref/u:DI ("*.LC169") [flags 0x2])
      (const_int 8 [0x8])))
$1 = void

constant_pool_expr_p() returns true this PLUS expressions, but
get_pool_constant only works on SYMBOL_REFs.  GCC ICEs with an RTL
accessor checking failure in SYMBOL_REF_CONSTANT.

The attached patch adds checks in rs6000.c in all places where
get_pool_constant() is called after constant_pool_expr_p().

Bootstrapped and tested on powerpc64-linux (-m32/-m64).  OK?

Gr.
Steven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rs6000_tighten_const_pool_refs.diff
Type: text/x-diff
Size: 1310 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080530/8c82158d/attachment.bin>


More information about the Gcc-patches mailing list