* src/SDCCast.c (decorateType): partial fix for RFE 1475769, remove cast to same...
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 25 Apr 2006 11:25:05 +0000 (11:25 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 25 Apr 2006 11:25:05 +0000 (11:25 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4124 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCast.c

index caa9dae5cda1bb80b1c9a10e7c3367add3f12029..eb0c7676e10a7244044e24a6faad2d05bd7592c0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-04-25 Bernhard Held <bernhard AT bernhardheld.de>
+
+       * src/SDCCast.c (decorateType): partial fix for RFE 1475769,
+       remove cast to same type        
+
 2006-04-24 Bernhard Held <bernhard AT bernhardheld.de>
 
        Enabled VPATH feature: changed nearly all Makefiles (149 files).
index f240fc9734732895ba3356ea7cfbace397ead992..9a5bf4385365554783452b845fbf267d759880d9 100644 (file)
@@ -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       */
       {