From: epetrich Date: Sat, 27 Sep 2003 07:03:21 +0000 (+0000) Subject: * src/SDCCicode.c (geniCodeJumpTable): Fixed bug #813206 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=f754f67b0e6bdbc252b7a88ba83f919a8f48c966;p=fw%2Fsdcc * src/SDCCicode.c (geniCodeJumpTable): Fixed bug #813206 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2910 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 161e0ede..70fe2872 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-09-27 Erik Petrich + + * src/SDCCicode.c (geniCodeJumpTable): Fixed bug #813206 + 2003-09-26 Erik Petrich * src/SDCCdflow.c (computeDataFlow): Fixed bug #810746 diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 381e43fa..0833e41d 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -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