Make &array[const] compile
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 28 Feb 2000 05:03:43 +0000 (05:03 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 28 Feb 2000 05:03:43 +0000 (05:03 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@134 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCicode.c

index 7213568f9a70f759c5ae9af15f74b842f230bbff..46119d3ed4a3e3a36030148db3ecb7535b2ac3e7 100644 (file)
@@ -2074,7 +2074,16 @@ operand *geniCodeDerefPtr (operand *op)
     if (IS_PTR(optype)) 
        setOClass(optype,retype);    
         
-
+    #if 1
+    /* This block moved here from its original location
+     * ten lines later by KV, 2/27/2000.
+     * 
+     * This allows code of the form "&array[const]" to
+     * compile properly.
+     */
+    if (!lvaluereq)
+       op = geniCodeRValue(op, TRUE);
+    #endif
     op->isGptr = IS_GENPTR(optype);
 
     /* if the pointer was declared as a constant */
@@ -2088,8 +2097,11 @@ operand *geniCodeDerefPtr (operand *op)
                  IS_CHAR(rtype)   ||
                  IS_FLOAT(rtype) );
 
+    #if 0
+    /* Moved upwards */
     if (!lvaluereq)
        op = geniCodeRValue(op,TRUE);
+    #endif
     setOperandType(op,rtype);
     
     return op;