fixed bug #698231
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 22 Mar 2003 16:57:44 +0000 (16:57 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 22 Mar 2003 16:57:44 +0000 (16:57 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2405 4a8a32a2-be11-0410-ad9d-d568d2c75423

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))
     {