While debugging the selective scheduler problem, Jakub pointed out
that not all AIX TOC references are in the constant pool, causing an
ICE for him.  This patch checks that the TOC operand is a symbol ref
in the constant pool before trying to check its value.

* config/rs6000/rs6000.c (rs6000_delegitimize_address): Check that TOC
operand is
a valid symbol ref in the constant pool.

Index: rs6000.c
===================================================================
--- rs6000.c    (revision 195397)
+++ rs6000.c    (working copy)
@@ -5831,6 +5831,8 @@ rs6000_delegitimize_address (rtx orig_x)
       /* Do not associate thread-local symbols with the original
         constant pool symbol.  */
       if (TARGET_XCOFF
+         && GET_CODE (y) == SYMBOL_REF
+         && CONSTANT_POOL_ADDRESS_P (y)
          && SYMBOL_REF_TLS_MODEL (get_pool_constant (y)) >= TLS_MODEL_REAL)
        return orig_x;
 #endif

Reply via email to