X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCast.c;h=9a5bf4385365554783452b845fbf267d759880d9;hb=35dd80db0d3859c5635bca13032e2d2b1fe15713;hp=f240fc9734732895ba3356ea7cfbace397ead992;hpb=2445815caa572f0151cbb551b2d7b55ef95786ba;p=fw%2Fsdcc diff --git a/src/SDCCast.c b/src/SDCCast.c index f240fc97..9a5bf438 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -3629,6 +3629,13 @@ decorateType (ast * tree, RESULT_TYPE resultType) changePointer(LTYPE(tree)); checkTypeSanity(LETYPE(tree), "(cast)"); + /* if 'from' and 'to' are the same remove the superflous cast, */ + /* this helps other optimizations */ + if (compareTypeExact (LTYPE(tree), RTYPE(tree), -1) == 1) + { + return tree->right; + } + /* If code memory is read only, then pointers to code memory */ /* implicitly point to constants -- make this explicit */ {