* src/SDCCsymt.c (initCSupport): Removed managling of support function
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 2 Mar 2002 03:40:54 +0000 (03:40 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 2 Mar 2002 03:40:54 +0000 (03:40 +0000)
names.
      * src/z80/ralloc.c (packRegsForIYUse): Fixed fp bug where four byte
operands were packed into IY.

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

ChangeLog
src/SDCCsymt.c
src/z80/ralloc.c
support/regression/tests/bug-477835.c [new file with mode: 0644]
support/regression/tests/bug-499644.c [new file with mode: 0644]
support/regression/tests/bug-500536.c [new file with mode: 0644]

index 2eb3e842e2cd6e337530e9f66d1dc5715005b233..62817d17361668e5e235c1e691d9d0df30b6b9be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-01  Michael Hope  <michaelh@vroom>
+
+       * src/SDCCsymt.c (initCSupport): Removed managling of support function names.
+
+       * src/z80/ralloc.c (packRegsForIYUse): Fixed fp bug where four byte operands were packed into IY.
+
 2002-03-01    <johan@FRIJA>
 
        * src/SDCCglue.c (printIvalPtr): fixed bug #524211
index 7ffa31be56e08e7a4b28652d2912aa562db3e4c8..09611d190f955e89ed3fcc7c52e0c6263f6856e2 100644 (file)
@@ -2540,12 +2540,12 @@ initCSupport ()
              if (tofrom)
                {
                  sprintf (buffer, "__fs2%s%s", ssu[su], sbwd[bwd]);
-                 __conv[tofrom][bwd][su] = funcOfType (_mangleFunctionName(buffer), __multypes[bwd][su], floatType, 1, options.float_rent);
+                 __conv[tofrom][bwd][su] = funcOfType (buffer, __multypes[bwd][su], floatType, 1, options.float_rent);
                }
              else
                {
                  sprintf (buffer, "__%s%s2fs", ssu[su], sbwd[bwd]);
-                 __conv[tofrom][bwd][su] = funcOfType (_mangleFunctionName(buffer), floatType, __multypes[bwd][su], 1, options.float_rent);
+                 __conv[tofrom][bwd][su] = funcOfType (buffer, floatType, __multypes[bwd][su], 1, options.float_rent);
                }
            }
        }
index d73acaa0cd4286f85f442266ddc76aafefc68d8a..6e97b1da76c1f751639d006f6ba5fd1a057b4007 100644 (file)
@@ -2442,6 +2442,12 @@ packRegsForIYUse (iCode * lic, operand * op, eBBlock * ebp)
       return NULL;
     }
 
+  if (getSize (operandType (op)) != 2)
+    {
+      D (D_ACCUSE2, ("  + Dropping as operation has size is too big\n"));
+      return FALSE;
+    }
+
   /* Nothing else that clashes with this is using the scratch
      register.  Scan through all of the intermediate instructions and
      see if any of them could nuke HL.
diff --git a/support/regression/tests/bug-477835.c b/support/regression/tests/bug-477835.c
new file mode 100644 (file)
index 0000000..294b419
--- /dev/null
@@ -0,0 +1,31 @@
+/* Registers not being saved.
+ */
+#include <testfwk.h>
+
+/* In the following code BC is assigned a copy of fp, but bc is not
+   saved across the call.
+*/
+void
+fptr(void (*fp)(void))
+{
+  int i;
+  for (i = 0; i < 50; i++)
+    (*fp)();
+}
+
+void dummy(void (*fp)(void))
+{
+  UNUSED(fp);
+}
+
+/* This code has the same logic above, but bc is saved.
+ */
+void
+fptr2(void (*fp)(void))
+{
+  int i;
+  void (*fp2)(void) = fp;
+
+  for (i = 0; i < 50; i++)
+    dummy(fp2);
+}
diff --git a/support/regression/tests/bug-499644.c b/support/regression/tests/bug-499644.c
new file mode 100644 (file)
index 0000000..bec1611
--- /dev/null
@@ -0,0 +1,10 @@
+/* Floats
+ */
+#include <testfwk.h>
+
+const float a = 0.0; 
+
+float f(void) 
+{ 
+  return a * 5; 
+} 
diff --git a/support/regression/tests/bug-500536.c b/support/regression/tests/bug-500536.c
new file mode 100644 (file)
index 0000000..bd3945d
--- /dev/null
@@ -0,0 +1,52 @@
+/* Bad mangaling of support names.
+ */
+#include <testfwk.h>
+
+/* The original bug */
+float z1(void)
+{
+  return 5;
+}
+
+float fun( void ) 
+{ 
+  unsigned long i; 
+  float f; 
+  i=5.5 * z1(); 
+  f=i; 
+  if (i & 1) 
+    f += 1.0; 
+  return f; 
+} 
+
+/* Tests to check basic conversion */
+void
+testfs2long(void)
+{
+  volatile float f;
+  volatile unsigned long ul;
+  volatile long l;
+
+  f = 5.0;
+  ul = f;
+  ASSERT(ul == 5);
+
+  l = f;
+  ASSERT(l == 5);
+
+  f = -134;
+  l = f;
+  ASSERT(l == -134);
+
+  l = 4567;
+  f = l;
+  ASSERT(f == 4567.0);
+
+  l = -1539;
+  f = l;
+  ASSERT(f == -1539.0);
+
+  ul = 9995;
+  f = ul;
+  ASSERT(f == 9995.0);
+}