* src/*/ralloc.c: removed IS_OP_RUONLY macro
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 4 Mar 2008 21:28:19 +0000 (21:28 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 4 Mar 2008 21:28:19 +0000 (21:28 +0000)
* src/ds390/ralloc.c (packRegisters),
* src/mcs51/ralloc.c (packRegisters),
* src/z80/ralloc.c (packRegisters): applied fix for bug 1618050, thanks
  Robert Larice
* support/regression/tests/bug1618050.c: new, added
* support/regression/fwk/include/testfwk.h,
* support/regression/tests/bug1838000.c: moved _AUTOMEM and _STATMEM to
  testfwk.h
* src/SDCCsymt.h: fixed typo in DECLSPEC2TXT

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5069 4a8a32a2-be11-0410-ad9d-d568d2c75423

13 files changed:
ChangeLog
src/SDCCsymt.h
src/avr/ralloc.c
src/ds390/ralloc.c
src/hc08/ralloc.c
src/mcs51/ralloc.c
src/pic/ralloc.c
src/pic16/ralloc.c
src/xa51/ralloc.c
src/z80/ralloc.c
support/regression/fwk/include/testfwk.h
support/regression/tests/bug1618050.c [new file with mode: 0644]
support/regression/tests/bug1838000.c

index e11476d581a5a8d332c770dbfd9cd70e8410667f..323fbf18719c1f41955389f59e8a4270a0864827 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,16 @@
        * src/SDCCutil.h: added getBuildDate()
        * src/SDCCmain.c (printVersionInfo),
        * src/SDCCglue.c (initialComments): use getBuildDate() instead of __DATE__
+       * src/*/ralloc.c: removed IS_OP_RUONLY macro
+       * src/ds390/ralloc.c (packRegisters),
+       * src/mcs51/ralloc.c (packRegisters),
+       * src/z80/ralloc.c (packRegisters): applied fix for bug 1618050, thanks
+         Robert Larice
+       * support/regression/tests/bug1618050.c: new, added
+       * src/SDCCsymt.h: fixed typo in DECLSPEC2TXT
+       * support/regression/fwk/include/testfwk.h,
+       * support/regression/tests/bug1838000.c: moved _AUTOMEM and _STATMEM to
+         testfwk.h
 
 2008-03-04 Raphael Neider <rneider AT web.de>
 
index 79230277b586947d5cae4404cf6f747c3ef8f5e1..da91be01acb251686ad2809e3bef046f96cd4223 100644 (file)
@@ -217,7 +217,7 @@ typedef enum {
   DECLARATOR=1,
   SPECIFIER
 } SYM_LINK_CLASS;
-#define DECLSPEC2TXT(select) (select==DECLARATOR?"DECLARATOR":select==SPECIFIER?"SPECIFIER":"UNKNOW")
+#define DECLSPEC2TXT(select) (select==DECLARATOR?"DECLARATOR":select==SPECIFIER?"SPECIFIER":"UNKNOWN")
 
 typedef struct sym_link
   {
@@ -505,7 +505,7 @@ extern sym_link *validateLink(sym_link  *l,
                                        x->select.s.noun == V_SBIT ))
 #define IS_BITFIELD(x) (IS_SPEC(x) && (x->select.s.noun == V_BITFIELD))
 #define IS_BITVAR(x) (IS_SPEC(x) && (x->select.s.noun == V_BITFIELD || \
-                                     x->select.s.noun  == V_BIT ||   \
+                                     x->select.s.noun == V_BIT || \
                                      x->select.s.noun == V_SBIT ))
 #define IS_BIT(x) (IS_SPEC(x) && (x->select.s.noun  == V_BIT ||   \
                                   x->select.s.noun == V_SBIT ))
index 9f0ab65b28613f89fce0f1188a9bcc8cab5ad371..512edc4fdf7f068101e6c1677cfac87a316ef301 100644 (file)
@@ -1829,8 +1829,6 @@ packRegsForAssign (iCode * ic, eBBlock * ebp)
 
 }
 
-#define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly)
-
 
 /*-----------------------------------------------------------------*/
 /* packRegsForOneuse : - will reduce some registers for single Use */
index 3db3a8483279d9b17e34550f993e015ce7c4dc09..f166a647fb3cca1e62c3708363db33077df0e18a 100644 (file)
@@ -2475,8 +2475,6 @@ right:
   return change;
 }
 
-#define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly)
-
 
 /*-----------------------------------------------------------------*/
 /* packRegsDPTRnuse - color live ranges that can go into extra DPTRS */
@@ -3069,6 +3067,7 @@ packRegisters (eBBlock ** ebpp, int blockno)
           IS_SYMOP (IC_RIGHT (ic)) &&
           OP_SYMBOL (IC_RIGHT (ic))->remat &&
           !IS_CAST_ICODE(OP_SYMBOL (IC_RIGHT (ic))->rematiCode) &&
+          !isOperandGlobal(IC_RESULT(ic)) &&          /* due to bug 1618050 */
           bitVectnBitsOn (OP_SYMBOL (IC_RESULT (ic))->defs) <= 1)
         {
           OP_SYMBOL (IC_RESULT (ic))->remat =
index f109c275736b4a254db7b6a4fa5748c6d309d3f3..bdbcda2809458935d65df8de2dbcf5c34fd4b632 100644 (file)
@@ -2277,8 +2277,6 @@ packRegsForSupport (iCode * ic, eBBlock * ebp)
   return changes;
 }
 
-#define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly)
-
 
 #if 0
 /*-----------------------------------------------------------------*/
index 62fb84c5df0520cf48f2da8e4cb061548dd67805..2a627aade38fade32b735d965faa979edbcdd4f7 100644 (file)
@@ -3015,6 +3015,7 @@ packRegisters (eBBlock ** ebpp, int blockno)
           IS_SYMOP (IC_RIGHT (ic)) &&
           OP_SYMBOL (IC_RIGHT (ic))->remat &&
           !IS_CAST_ICODE(OP_SYMBOL (IC_RIGHT (ic))->rematiCode) &&
+          !isOperandGlobal(IC_RESULT(ic)) &&          /* due to bug 1618050 */
           bitVectnBitsOn (OP_SYMBOL (IC_RESULT (ic))->defs) <= 1)
         {
           OP_SYMBOL (IC_RESULT (ic))->remat =
index d2c184c11328870086fabe49697f693c41e516ff..9b181ce601f15b6bdb783cd5b5ef5d5076c233ff 100644 (file)
@@ -3217,8 +3217,6 @@ right:
         return change;
 }
 
-#define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly)
-
 
 /*-----------------------------------------------------------------*/
 /* packRegsForOneuse : - will reduce some registers for single Use */
index c79ccfdb40cc45694b5755821149f766afcb6e7e..6bd0c35cec7ed8560ee9fe44b5de05d857386f05 100644 (file)
@@ -3411,8 +3411,6 @@ right:
 #endif
 
 
-#define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly)
-
 #ifndef NO_packRegsForOneuse
 /*-----------------------------------------------------------------*/
 /* packRegsForOneuse : - will reduce some registers for single Use */
index ac0d124b5685e071839b972532f723ae18037250..830a30f18d559fad3cbab5e4b78c32e7861e12c2 100644 (file)
@@ -1609,8 +1609,6 @@ packRegsForSupport (iCode * ic, eBBlock * ebp)
   return change;
 }
 
-#define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly)
-
 
 /*-----------------------------------------------------------------*/
 /* packRegsForOneuse : - will reduce some registers for single Use */
index 316063d746084b4f9413ff3cb7c1d8356c86221f..fc3cfd1dc7177530d91868287d09e28cb404d4a1 100644 (file)
@@ -1978,8 +1978,6 @@ right:
 }
 #endif
 
-#define IS_OP_RUONLY(x) (x && IS_SYMOP(x) && OP_SYMBOL(x)->ruonly)
-
 /** Will reduce some registers for single use.
  */
 static iCode *
@@ -2978,9 +2976,10 @@ packRegisters (eBBlock * ebp)
           !POINTER_SET (ic) &&
           IS_SYMOP (IC_RIGHT (ic)) &&
           OP_SYMBOL (IC_RIGHT (ic))->remat &&
+          !IS_CAST_ICODE(OP_SYMBOL (IC_RIGHT (ic))->rematiCode) &&
+          !isOperandGlobal(IC_RESULT(ic)) &&          /* due to bug 1618050 */
           bitVectnBitsOn (OP_SYMBOL (IC_RESULT (ic))->defs) <= 1)
         {
-
           OP_SYMBOL (IC_RESULT (ic))->remat =
             OP_SYMBOL (IC_RIGHT (ic))->remat;
           OP_SYMBOL (IC_RESULT (ic))->rematiCode =
index 81e82253cfee73e3260751713307b93b106c88c9..1e5d581baf069e08d89946524b8fa98c7dad73d0 100644 (file)
@@ -11,6 +11,13 @@ void __printf(const char *szFormat, ...);
 #define LOG(_a)     /* hollow log */
 #endif
 
+#ifdef SDCC
+ #include <sdcc-lib.h>
+#else
+ #define _AUTOMEM
+ #define _STATMEM
+#endif
+
 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
 # define data
 # define idata
diff --git a/support/regression/tests/bug1618050.c b/support/regression/tests/bug1618050.c
new file mode 100644 (file)
index 0000000..cd0d21b
--- /dev/null
@@ -0,0 +1,26 @@
+/** bug 1618050
+ *    global variable px in function buggy, is marked rematr..
+ *    and is erronously assumed to retain its value "x" across
+ *    the function call to fiddle_px
+ */
+
+#include <testfwk.h>
+
+_STATMEM char * data px;
+_STATMEM char x[2] = {0,42};
+
+void fiddle_px(_STATMEM char * unused) {
+  (volatile char) unused[0]; // shut up
+  px++;
+}
+
+char buggy(void) {
+  px = x;
+  fiddle_px(x);
+  return *px;
+}
+
+void
+testBug(void) {
+  ASSERT(buggy() == 42);
+}
index eb54db930f465902060ca65accde03bc2f6a4f3a..5bafa2f1efd4d68e62600fcbdbfb9909ecc32e6f 100644 (file)
@@ -4,13 +4,6 @@
 \r
 #include <testfwk.h>\r
 \r
-#ifdef SDCC\r
- #include <sdcc-lib.h>\r
-#else\r
- #define _AUTOMEM\r
- #define _STATMEM\r
-#endif\r
-\r
 typedef struct { char b:1; } t;\r
 t glbl = { 0 };\r
 t _STATMEM * gp = &glbl;\r