* src/SDCCast.c (isLoopCountable): fixed bug #1478316
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 30 May 2006 14:36:36 +0000 (14:36 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 30 May 2006 14:36:36 +0000 (14:36 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4197 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCast.c

index 3063744f983dd31b371dc48456699c5b991e903c..346a01a563816e7547efaffd56250e5a448473e2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-05-30 Bernhard Held <bernhard AT bernhardheld.de>
+
+       * src/SDCCast.c (isLoopCountable): fixed bug #1478316
+
 2006-05-27 Bernhard Held <bernhard AT bernhardheld.de>
 
        * src/SDCCcse.c (findPointerSet): fixed bug #1493710
index 66452408a22bd8a0763695d22b88918b499262ae..beb2becad5976f0a5c19f6986da5e309b42d3427 100644 (file)
@@ -1497,7 +1497,7 @@ isLabelInAst (symbol * label, ast * tree)
 /* isLoopCountable - return true if the loop count can be determi- */
 /* -ned at compile time .                                          */
 /*-----------------------------------------------------------------*/
-bool
+static bool
 isLoopCountable (ast * initExpr, ast * condExpr, ast * loopExpr,
                  symbol ** sym, ast ** init, ast ** end)
 {
@@ -1522,6 +1522,10 @@ isLoopCountable (ast * initExpr, ast * condExpr, ast * loopExpr,
   else
     return FALSE;
 
+  /* don't reverse loop with volatile counter */
+  if (IS_VOLATILE ((*sym)->type))
+    return FALSE;
+
   /* for now the symbol has to be of
      integral type */
   if (!IS_INTEGRAL ((*sym)->type))
@@ -1927,7 +1931,7 @@ isConformingBody (ast * pbody, symbol * sym, ast * body)
 /* if the for loop is reversible. If yes will set the value of     */
 /* the loop control var & init value & termination value           */
 /*-----------------------------------------------------------------*/
-bool
+static bool
 isLoopReversible (ast * loop, symbol ** loopCntrl,
                   ast ** init, ast ** end)
 {