* src/SDCCicode.c (geniCodeJumpTable): Fixed bug #813206
authorepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 27 Sep 2003 07:03:21 +0000 (07:03 +0000)
committerepetrich <epetrich@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 27 Sep 2003 07:03:21 +0000 (07:03 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2910 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCicode.c

index 161e0edede9f24adf5776c48966debc93c88aaae..70fe287297f733d476792a8fb47b506d9b83053e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-09-27  Erik Petrich <epetrich@ivorytower.norman.ok.us>
+
+       * src/SDCCicode.c (geniCodeJumpTable): Fixed bug #813206
+
 2003-09-26  Erik Petrich <epetrich@ivorytower.norman.ok.us>
 
        * src/SDCCdflow.c (computeDataFlow): Fixed bug #810746
index 381e43fa46688418d6f0acea0ae8dc4db3cf94eb..0833e41d0cd883098ed691c04586695ed319ecf9 100644 (file)
@@ -3211,6 +3211,8 @@ geniCodeJumpTable (operand * cond, value * caseVals, ast * tree)
   operand *boundary;
   symbol *falseLabel;
   set *labels = NULL;
+  int needRangeCheck = !optimize.noJTabBoundary
+                       || tree->values.switchVals.swDefault;
 
   if (!tree || !caseVals)
     return 0;
@@ -3246,7 +3248,7 @@ geniCodeJumpTable (operand * cond, value * caseVals, ast * tree)
   /* if the number of case statements <= 2 then */
   /* it is not economical to create the jump table */
   /* since two compares are needed for boundary conditions */
-  if ((!optimize.noJTabBoundary && cnt <= 2) || max > (255 / 3))
+  if ((needRangeCheck && cnt <= 2) || max > (255 / 3))
     return 0;
 
   if (tree->values.switchVals.swDefault)
@@ -3264,7 +3266,7 @@ geniCodeJumpTable (operand * cond, value * caseVals, ast * tree)
   /* so we can create a jumptable */
   /* first we rule out the boundary conditions */
   /* if only optimization says so */
-  if (!optimize.noJTabBoundary)
+  if (needRangeCheck)
     {
       sym_link *cetype = getSpec (operandType (cond));
       /* no need to check the lower bound if