* as/z80/aslist.c (lstsym): changed old K&R to ANSI
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 7 Sep 2008 12:19:47 +0000 (12:19 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 7 Sep 2008 12:19:47 +0000 (12:19 +0000)
* src/SDCCicode.c (geniCodeCritical): fixed bug for hc08
* src/z80/gen.c (genCritical, genEndCritical): fixed bug 2077267
* support/regression/tests/bug2077267.c: new, added

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

ChangeLog
as/z80/aslist.c
src/SDCCicode.c
src/z80/gen.c
support/regression/tests/bug2077267.c [new file with mode: 0644]

index 10751475fa91745a6e54573fcd54f84c780f005f..a025623f08ff7099cf17b648b53e92bd9d454d64 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-06-04 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * as/z80/aslist.c (lstsym): changed old K&R to ANSI
+       * src/SDCCicode.c (geniCodeCritical): fixed bug for hc08
+       * src/z80/gen.c (genCritical, genEndCritical): fixed bug 2077267
+       * support/regression/tests/bug2077267.c: new, added
+
 2008-09-05 Raphael Neider <rneider AT web.de>
 
        * configure.in, Makefile.common.in: add support for ccache,
index 0a8293bb1f0a7f57c6e881f2b269fb959de1882b..b4ac09334f77cce62b2724a1274fefe3989aac4e 100644 (file)
@@ -565,7 +565,6 @@ int flag;
  *              int     i               loop counter
  *              int     j               temporary
  *              int     k               temporary
- *              char *  ptr             pointer to an id string
  *              int     nmsym           number of symbols
  *              int     narea           number of areas
  *              sym *   sp              pointer to symbol structure
@@ -596,8 +595,7 @@ int flag;
  */
 
 VOID
-lstsym(fp)
-FILE *fp;
+lstsym(FILE *fp)
 {
         register int c, i, j, k;
         int nmsym, narea;
index 6c8ee8a8ac6fd200f8f1298b87b2acb29b2850aa..fe437728ce97f42e0c4663a2e65b8a25a3f8b5df 100644 (file)
@@ -3980,7 +3980,7 @@ geniCodeCritical (ast *tree, int lvl)
   operand *op = NULL;
   sym_link *type;
 
-  if (!options.stackAuto)
+  if (!options.stackAuto && !TARGET_IS_HC08)
     {
       type = newLink(SPECIFIER);
       SPEC_VOLATILE(type) = 1;
index 773a4f66dd6161a4c4ddb2e1d97ecfc3848bd28b..2ef191da5a0f8b66ab8c8db4dd50a3756480d224 100644 (file)
@@ -7616,7 +7616,7 @@ genCritical (iCode *ic)
       //disable interrupt
       emit2 ("!di");
       //save P/O flag
-      emit2 ("push af");
+      _push (PAIR_AF);
     }
 }
 
@@ -7645,7 +7645,7 @@ genEndCritical (iCode *ic)
   else
     {
       //restore P/O flag
-      emit2 ("pop af");
+      _pop (PAIR_AF);
       //parity odd <==> P/O=0 <==> interrupt enable flag IFF2 was 0 <==>
       //don't enable interrupts as they were off before
       emit2 ("jp PO,!tlabel", tlbl->key + 100);
diff --git a/support/regression/tests/bug2077267.c b/support/regression/tests/bug2077267.c
new file mode 100644 (file)
index 0000000..f0b4da0
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+    bug 2077267
+*/
+
+#include <testfwk.h>
+
+#ifndef SDCC
+#define __critical
+#endif
+
+void bug(char* x)
+{
+    *x = *x + 1;
+}
+
+void
+testBug(void)
+{
+    char x = 1;
+
+    bug(&x);
+
+    __critical {
+        bug(&x);
+    }
+
+    ASSERT (x == 3);
+}