From 35dd80db0d3859c5635bca13032e2d2b1fe15713 Mon Sep 17 00:00:00 2001 From: bernhardheld Date: Tue, 25 Apr 2006 11:25:05 +0000 Subject: [PATCH] * src/SDCCast.c (decorateType): partial fix for RFE 1475769, remove cast to same type git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4124 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 5 +++++ src/SDCCast.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index caa9dae5..eb0c7676 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-04-25 Bernhard Held + + * src/SDCCast.c (decorateType): partial fix for RFE 1475769, + remove cast to same type + 2006-04-24 Bernhard Held Enabled VPATH feature: changed nearly all Makefiles (149 files). 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 */ { -- 2.30.2