is ineffective for unsigned char parameter
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5044
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2008-02-24 Borut Razem <borut.razem AT siol.net>
+
+ * src/SDCCast.c, src/SDCCast.h: fixed bug #1874922: explicit typecast
+ is ineffective for unsigned char parameter
+
2008-02-24 Maarten Brock <sourceforge.brock AT dse.nl>
* src/SDCCast.c (expandInlineFuncs): fixed bug 1875869
2008-02-24 Maarten Brock <sourceforge.brock AT dse.nl>
* src/SDCCast.c (expandInlineFuncs): fixed bug 1875869
2008-02-22 Philipp Klaus Krause <pkk AT spth.de>
* src/z80/gen.c (genMult): Rewrote 8-bit multiplication by constant,
2008-02-22 Philipp Klaus Krause <pkk AT spth.de>
* src/z80/gen.c (genMult): Rewrote 8-bit multiplication by constant,
2008-02-22 Philipp Klaus Krause <pkk AT spth.de>
* device/lib/z80/mul.s: Rewrote __muluchar_rrx_s, to improve 8-bit mult.,
2008-02-22 Philipp Klaus Krause <pkk AT spth.de>
* device/lib/z80/mul.s: Rewrote __muluchar_rrx_s, to improve 8-bit mult.,
2008-02-22 Maarten Brock <sourceforge.brock AT dse.nl>
2008-02-22 Maarten Brock <sourceforge.brock AT dse.nl>
dest->level = src->level;
dest->funcName = src->funcName;
dest->reversed = src->reversed;
dest->level = src->level;
dest->funcName = src->funcName;
dest->reversed = src->reversed;
+ dest->actualArgument = src->actualArgument;
if (src->ftype)
dest->etype = getSpec (dest->ftype = copyLinkChain (src->ftype));
if (src->ftype)
dest->etype = getSpec (dest->ftype = copyLinkChain (src->ftype));
+ /* mark the actual parameter */
+ (*actParm)->actualArgument = 1;
+
/* decorate parameter */
resultType = defParm ? getResultTypeFromType (defParm->type) :
RESULT_TYPE_NONE;
/* decorate parameter */
resultType = defParm ? getResultTypeFromType (defParm->type) :
RESULT_TYPE_NONE;
ast *newType = NULL;
sym_link *ftype;
ast *newType = NULL;
sym_link *ftype;
+ int isCast = IS_CAST_OP (*actParm);
+ int isAstLitValue = (IS_AST_LIT_VALUE (*actParm));
+
if (IS_CAST_OP (*actParm)
if (IS_CAST_OP (*actParm)
- || (IS_AST_LIT_VALUE (*actParm) && (*actParm)->values.literalFromCast))
+ || (IS_AST_LIT_VALUE (*actParm) && (*actParm)->values.literalFromCast))
{
/* Parameter was explicitly typecast; don't touch it. */
return 0;
{
/* Parameter was explicitly typecast; don't touch it. */
return 0;
changePointer(LTYPE(tree));
checkTypeSanity(LETYPE(tree), "(cast)");
changePointer(LTYPE(tree));
checkTypeSanity(LETYPE(tree), "(cast)");
- /* if 'from' and 'to' are the same remove the superfluous cast, */
- /* this helps other optimizations */
- if (compareTypeExact (LTYPE(tree), RTYPE(tree), -1) == 1)
+
+ /* if not an actual argument and
+ * if 'from' and 'to' are the same remove the superfluous cast,
+ * this helps other optimizations */
+ if (!tree->actualArgument && compareTypeExact (LTYPE(tree), RTYPE(tree), -1) == 1)
if (!options.lessPedantic)
werrorfl (tree->filename, tree->lineno, W_COMP_RANGE,
ccr_result == CCR_ALWAYS_TRUE ? "true" : "false");
if (!options.lessPedantic)
werrorfl (tree->filename, tree->lineno, W_COMP_RANGE,
ccr_result == CCR_ALWAYS_TRUE ? "true" : "false");
- return decorateType (newAst_VALUE (constCharVal (
- (unsigned char)(ccr_result == CCR_ALWAYS_TRUE ? 1 : 0))),
- resultType);
+ return decorateType (newAst_VALUE (constCharVal ((unsigned char)(ccr_result == CCR_ALWAYS_TRUE))), resultType);
case CCR_OK:
default:
break;
case CCR_OK:
default:
break;
ast * assigntree;
symbol * parm;
ast * passedarg = inlineFindParm (tree->right, argIndex);
ast * assigntree;
symbol * parm;
ast * passedarg = inlineFindParm (tree->right, argIndex);
if (!passedarg)
{
werror(E_TOO_FEW_PARMS);
if (!passedarg)
{
werror(E_TOO_FEW_PARMS);
unsigned lvalue:1;
unsigned initMode:1;
unsigned reversed:1;
unsigned lvalue:1;
unsigned initMode:1;
unsigned reversed:1;
+ unsigned actualArgument:1; /* actual function argument */
int level; /* level for expr */
int block; /* block number */
int seqPoint; /* sequence point */
int level; /* level for expr */
int block; /* block number */
int seqPoint; /* sequence point */