fixed bug #698231
[fw/sdcc] / src / SDCCicode.c
index dd464450e0a82984aa1fd519da6fbad42e67b759..18cf40ce70c2d9e6c6d2ee92e8c875732b464d98 100644 (file)
@@ -2531,6 +2531,15 @@ geniCodeDerefPtr (operand * op,int lvl)
   sym_link *rtype, *retype;
   sym_link *optype = operandType (op);
 
+  // if this is an array then array access
+  if (IS_ARRAY (optype)) {
+    // don't worry, this will be optimized out later
+    return geniCodeArray (op, operandFromLit (0), lvl);
+  }
+
+  // just in case someone screws up
+  wassert (IS_PTR (optype));
+
   /* if this is a pointer then generate the rvalue */
   if (IS_PTR (optype))
     {