fix segfault on casting int to pointer
[fw/sdcc] / src / ds390 / ralloc.c
index ecec03eafef81194f653bf18ff7a3cebab333bdb..cb3062616cbabd8e122fe99c437f9b80b55bc019 100644 (file)
@@ -36,8 +36,6 @@
 /* since the pack the registers depending strictly on the MCU      */
 /*-----------------------------------------------------------------*/
 
-extern void gen390Code(iCode *);
-
 /* Global data */
 static struct {
     bitVect *spiltSet;
@@ -1078,7 +1076,8 @@ static void serialRegAssign (eBBlock **ebbs, int count)
                
                /* if we need ptr regs for the right side
                   then mark it */
-               if (POINTER_GET(ic) && getSize(OP_SYMBOL(IC_LEFT(ic))->type) 
+               if (POINTER_GET(ic) && IS_SYMOP(IC_LEFT(ic))
+                && getSize(OP_SYMBOL(IC_LEFT(ic))->type) 
                    <= PTRSIZE) 
                {
                    ds390_ptrRegReq++;
@@ -1722,6 +1721,14 @@ static int packRegsForSupport (iCode *ic, eBBlock *ebp)
 /*-----------------------------------------------------------------*/
 static iCode *packRegsForOneuse (iCode *ic, operand *op , eBBlock *ebp)
 {
+#if 1
+    
+    /* I can't figure out how to make this safe yet. */
+    ic; op; ebp;
+    return NULL;
+    
+    
+#else
     bitVect *uses ;
     iCode *dic, *sic;
 
@@ -1838,7 +1845,7 @@ static iCode *packRegsForOneuse (iCode *ic, operand *op , eBBlock *ebp)
                
     OP_SYMBOL(op)->ruonly = 1;
     return sic;
-       
+#endif 
 }
 
 /*-----------------------------------------------------------------*/
@@ -2100,7 +2107,7 @@ static void packRegisters (eBBlock *ebp)
              bitVectnBitsOn(OP_DEFS(IC_RESULT(ic))) == 1 &&
             IS_OP_LITERAL(IC_RIGHT(ic))) ) {
 
-           int i = operandLitValue(IC_RIGHT(ic));
+           //int i = operandLitValue(IC_RIGHT(ic));
            OP_SYMBOL(IC_RESULT(ic))->remat = 1;
            OP_SYMBOL(IC_RESULT(ic))->rematiCode = ic;
            OP_SYMBOL(IC_RESULT(ic))->usl.spillLoc = NULL;
@@ -2193,7 +2200,8 @@ static void packRegisters (eBBlock *ebp)
            link *toType = operandType(IC_LEFT(ic));
 
            if (IS_INTEGRAL(fromType) && IS_INTEGRAL(toType) &&
-               getSize(fromType) != getSize(toType) ) {
+               getSize(fromType) != getSize(toType) && 
+               SPEC_USIGN(fromType) == SPEC_USIGN(toType)) {
 
                iCode *dic = packRegsForOneuse(ic,IC_RIGHT(ic),ebp);
                if (dic) {