Since Kevin decided to treat reentrant functions implicitly not IS_REGPARM-ed
[fw/sdcc] / src / SDCCast.c
index dc3a36e8790b2e1c4136c3bdc913041c9aac5314..bf8f2f60cacafeea8da012e5b427222d7e0909fe 100644 (file)
@@ -2793,14 +2793,20 @@ ast *backPatchLabels (ast *tree, symbol *trueLabel, symbol *falseLabel )
     
     /* change not */
     if (IS_NOT(tree)) {
+       int wasnot = IS_NOT(tree->left);
        tree->left = backPatchLabels (tree->left,falseLabel,trueLabel);
        
        /* if the left is already a IFX */
        if ( ! IS_IFX(tree->left) ) 
            tree->left = newNode (IFX,tree->left,NULL);
        
-       tree->left->trueLabel = falseLabel ;
-       tree->left->falseLabel= trueLabel ;
+       if (wasnot) {
+           tree->left->trueLabel = trueLabel ;
+           tree->left->falseLabel= falseLabel ;
+       } else {
+           tree->left->trueLabel = falseLabel ;
+           tree->left->falseLabel= trueLabel ;
+       }
        return tree->left ;
     }
     
@@ -3537,8 +3543,9 @@ ast  *createFunction   (symbol  *name,   ast  *body )
           we need to add the name to the publics list : this
           actually means we are now compiling the compiler
           support routine */
-       if (name->cdef)
+       if (name->cdef) {
            addSet(&publics,name);
+       }
     }
     else {
        addSymChain(name);