From 0e6cf188b9f92fb856bf66a17d2e1662497d8ac0 Mon Sep 17 00:00:00 2001 From: bernhardheld Date: Mon, 5 Jan 2004 20:51:59 +0000 Subject: [PATCH] * src/SDCCast.c (decorateType): fixed bug #870781 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3083 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 3 ++- src/SDCCast.c | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf4d5f84..3c08cc40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ * sim/ucsim/gui.src/Makefile.in: fixed an old typo * src/mcs51/gen.c (genRightShift): fixed bug #870788 * src/ds390/gen.c (genRightShift): fixed bug #870788 + * src/SDCCast.c (decorateType): fixed bug #870781 2004-01-06 Vangelis Rokas @@ -19,7 +20,7 @@ genFunction,genEndFunction: setup stack frame for the generated function, genAddrOf: will be changed according to bug 863624 - + * added files genutils.c and genutils.h which contain gen* debugged and optimised functions extracted from gen.c diff --git a/src/SDCCast.c b/src/SDCCast.c index 6974206c..91cda09b 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -1594,7 +1594,7 @@ astHasSymbol (ast * tree, symbol * sym) else return FALSE; } - + return astHasSymbol (tree->left, sym) || astHasSymbol (tree->right, sym); } @@ -2509,8 +2509,6 @@ decorateType (ast * tree) wtree = optimizeSWAP (tree); if (wtree != tree) return decorateType (wtree); - - // fall through } /* if left is a literal exchange left & right */ @@ -2537,6 +2535,8 @@ decorateType (ast * tree) decorateType (parent); } } + /* fall through */ + /*------------------------------------------------------------------*/ /*----------------------------*/ /* bitwise xor */ @@ -2578,7 +2578,8 @@ decorateType (ast * tree) /* if right is a literal and */ /* we can find a 2nd literal in a xor-tree then */ /* rearrange the tree */ - if (IS_LITERAL (RTYPE (tree))) + if (IS_LITERAL (RTYPE (tree)) && + tree->opval.op == '^') /* the same source is used by 'bitwise or' */ { ast *parent; ast *litTree = searchLitOp (tree, &parent, "^"); @@ -2598,6 +2599,8 @@ decorateType (ast * tree) RTYPE (tree), FALSE)); + return tree; + /*------------------------------------------------------------------*/ /*----------------------------*/ /* division */ -- 2.47.2