X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCast.c;h=f57bc1489db9bd8de82c98f483d28b920f2a1b94;hb=90bdb43b342189fcb94a398855d43f3f47f96738;hp=f3ae4175283b5039a973591c53ddbcea72da5e21;hpb=3931bd1a9e2e1a392ccc7aa099502d28d84104b4;p=fw%2Fsdcc diff --git a/src/SDCCast.c b/src/SDCCast.c index f3ae4175..f57bc148 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -2123,7 +2123,7 @@ reverseLoop (ast * loop, symbol * sym, ast * init, ast * end) /* searchLitOp - search tree (*ops only) for an ast with literal */ /*-----------------------------------------------------------------*/ static ast * -searchLitOp (ast *tree, ast **parent, const unsigned char *ops) +searchLitOp (ast *tree, ast **parent, const char *ops) { ast *ret; @@ -3093,7 +3093,7 @@ decorateType (ast * tree, RESULT_TYPE resultType) /* rearrange the tree */ if (IS_LITERAL (RTYPE (tree)) /* avoid infinite loop */ - && (TYPE_UDWORD) floatFromVal (tree->right->opval.val) != 1) + && (TYPE_TARGET_ULONG) floatFromVal (tree->right->opval.val) != 1) { ast *parent; ast *litTree = searchLitOp (tree, &parent, "/"); @@ -3537,7 +3537,7 @@ decorateType (ast * tree, RESULT_TYPE resultType) /* rearrange the tree */ if (IS_LITERAL (RTYPE (tree)) /* avoid infinite loop */ - && (TYPE_UDWORD) floatFromVal (tree->right->opval.val) != 0) + && (TYPE_TARGET_ULONG) floatFromVal (tree->right->opval.val) != 0) { ast *litTree, *litParent; litTree = searchLitOp (tree, &litParent, "+-"); @@ -3759,7 +3759,7 @@ decorateType (ast * tree, RESULT_TYPE resultType) /* if only the right side is a literal & we are shifting more than size of the left operand then zero */ if (IS_LITERAL (RTYPE (tree)) && - ((TYPE_UDWORD) floatFromVal (valFromType (RETYPE (tree)))) >= + ((TYPE_TARGET_ULONG) floatFromVal (valFromType (RETYPE (tree)))) >= (getSize (TETYPE (tree)) * 8)) { if (tree->opval.op==LEFT_OP || @@ -3866,7 +3866,8 @@ decorateType (ast * tree, RESULT_TYPE resultType) unsigned int gptype = 0; unsigned int addr = SPEC_ADDR (sym->etype); - if (IS_GENPTR (LTYPE (tree)) && GPTRSIZE > FPTRSIZE) + if (IS_GENPTR (LTYPE (tree)) && ((GPTRSIZE > FPTRSIZE) + || TARGET_IS_PIC16) ) { switch (SPEC_SCLS (sym->etype)) { @@ -3885,6 +3886,9 @@ decorateType (ast * tree, RESULT_TYPE resultType) break; default: gptype = 0; + + if(TARGET_IS_PIC16 && (SPEC_SCLS(sym->etype) == S_FIXED)) + gptype = GPTYPE_NEAR; } addr |= gptype << (8*(GPTRSIZE - 1)); } @@ -5320,7 +5324,7 @@ isBitAndPow2 (ast * tree) if (!IS_AST_LIT_VALUE (tree->right)) return -1; - return powof2 ((TYPE_UDWORD)AST_LIT_VALUE (tree->right)); + return powof2 ((TYPE_TARGET_ULONG)AST_LIT_VALUE (tree->right)); } /*-----------------------------------------------------------------*/ @@ -6114,10 +6118,10 @@ void ast_print (ast * tree, FILE *outfile, int indent) if (IS_LITERAL (tree->opval.val->etype)) { fprintf(outfile,"CONSTANT (%p) value = ", tree); if (SPEC_USIGN (tree->opval.val->etype)) - fprintf(outfile,"%u", (TYPE_UDWORD) floatFromVal(tree->opval.val)); + fprintf(outfile,"%u", (TYPE_TARGET_ULONG) floatFromVal(tree->opval.val)); else - fprintf(outfile,"%d", (TYPE_DWORD) floatFromVal(tree->opval.val)); - fprintf(outfile,", 0x%x, %f", (TYPE_UDWORD) floatFromVal(tree->opval.val), + fprintf(outfile,"%d", (TYPE_TARGET_LONG) floatFromVal(tree->opval.val)); + fprintf(outfile,", 0x%x, %f", (TYPE_TARGET_ULONG) floatFromVal(tree->opval.val), floatFromVal(tree->opval.val)); } else if (tree->opval.val->sym) { /* if the undefined flag is set then give error message */