Turned off an unneeded warning, added
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 2 Mar 2002 05:54:25 +0000 (05:54 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 2 Mar 2002 05:54:25 +0000 (05:54 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1970 4a8a32a2-be11-0410-ad9d-d568d2c75423

support/regression/tests/bug-524209.c
support/regression/tests/bug-524211.c
support/regression/tests/bug-524691.c

index fbb0cc45cb2512116f89397364a6ee166b23c3c8..a5b215e1aed8b01c291c9e80a78d4ea8cee98f72 100644 (file)
@@ -22,7 +22,7 @@ typedef struct _StringBuffer
 
 void _scan(StringBuffer *pSB)
 {
-  UNUSED(*pSB);
+  UNUSED(pSB);
 }
 
 void checkCast(void *pIn)
index 4ec15d89f0c5caeff3d793feb721082c53cd7456..0dee2d1e74755b5b030868e65c7a3749d467b515 100644 (file)
@@ -2,6 +2,9 @@
  */
 #include <testfwk.h>
 
+#if 0
+/* Disabled as this only shows a warning */
+
 typedef unsigned short UINT16;
 typedef unsigned char UINT8;
 
@@ -24,3 +27,4 @@ const Class Bar = {
 void foo(void)
 {
 }
+#endif
index 542cedcfbbb1e83d57474d8d84564eca2e5f96cf..a4442382b69065deea29919ca707e9a367d9cf68 100644 (file)
@@ -19,6 +19,7 @@ static HeapEntryState *_getHeapEntryState(void *p, HeapEntryState *pStates, UINT
       int iDiff;
 
       uMiddle = (uLeft + uRight)/2;
+      /* A divide by zero is added just before iDiff is assigned */
       iDiff = pStates[uMiddle].pBase - p;
 
       if (iDiff > 0)
@@ -37,3 +38,17 @@ static HeapEntryState *_getHeapEntryState(void *p, HeapEntryState *pStates, UINT
 
   return NULL;
 }
+
+void
+testDivByZero(void)
+{
+  HeapEntryState aStates[] = {
+    { (void *)1, 0 }
+  };
+  void *p = (void *)0x1234;
+
+  ASSERT(_getHeapEntryState(p, aStates, 1) == NULL);
+
+  aStates[0].pBase = p;
+  ASSERT(_getHeapEntryState(p, aStates, 1) == aStates + 0);
+}