From bb939d05cb3f6e3e8f8d5cb10a63b8d48e07a085 Mon Sep 17 00:00:00 2001 From: bernhardheld Date: Tue, 30 May 2006 14:36:36 +0000 Subject: [PATCH] * src/SDCCast.c (isLoopCountable): fixed bug #1478316 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4197 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++++ src/SDCCast.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3063744f..346a01a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-05-30 Bernhard Held + + * src/SDCCast.c (isLoopCountable): fixed bug #1478316 + 2006-05-27 Bernhard Held * src/SDCCcse.c (findPointerSet): fixed bug #1493710 diff --git a/src/SDCCast.c b/src/SDCCast.c index 66452408..beb2beca 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -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) { -- 2.30.2