* src/SDCCglue.c (tempfileandname): changed un*x tmp search paths to /tmp and /var...
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 6 Oct 2006 20:50:56 +0000 (20:50 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 6 Oct 2006 20:50:56 +0000 (20:50 +0000)
* src/SDCCast.c (addCast): Fixed bug 1571231: promote in case of RESULT_TYPE_IFX
* support/regression/tests/onebyte.c: added test

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

ChangeLog
src/SDCCast.c
src/SDCCglue.c
support/regression/tests/onebyte.c

index 28eb260168aaf7a9d53c4ef8f006a2dbfb1f27b7..56a0ceaa66820e33e3b15c6a6a95073129725462 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-10-06 Bernhard Held <bernhard AT bernhardheld.de>
+
+       * src/SDCCglue.c (tempfileandname): changed un*x tmp search paths
+       to /tmp and /var/tmp acc. LSB
+       * src/SDCCast.c (addCast): Fixed bug 1571231: promote in case of
+       RESULT_TYPE_IFX
+       * support/regression/tests/onebyte.c: added test
+
 2006-10-05 Jesus Calvino-Fraga <jesusc at ece.ubc.ca>
 
        * src/mcs51/gen.c: emitcode for "add a,0x%02x" requires only 8 bits.
index f57bc1489db9bd8de82c98f483d28b920f2a1b94..99582eef1a7bb8de13b71da86192976697a70a78 100644 (file)
@@ -2249,11 +2249,11 @@ addCast (ast *tree, RESULT_TYPE resultType, bool promote)
         newLink = newIntLink();
         upCasted = TRUE;
         break;
+      case RESULT_TYPE_IFX:
       case RESULT_TYPE_OTHER:
-        if (!promote)
-          return tree;
-        /* return type is long, float: promote char to int */
-        if (getSize (tree->etype) >= INTSIZE)
+        if (!promote ||
+            /* return type is ifx, long, float: promote char to int */
+            getSize (tree->etype) >= INTSIZE)
           return tree;
         newLink = newIntLink();
         upCasted = TRUE;
index 7cee8eb5841661ff1dda373b7a51ce60c5369f76..a4b8d4f8cf7a9891105d0afb1d8857bce73949db 100644 (file)
@@ -1966,7 +1966,7 @@ glue (void)
 /** Creates a temporary file with unique file name
     Scans, in order:
     - TMP, TEMP, TMPDIR env. variables
-    - if Un*x system: /usr/tmp and /tmp
+    - if Un*x system: /tmp and /var/tmp
     - root directory using mkstemp() if available
     - default location using tempnam()
 */
@@ -1999,14 +1999,14 @@ tempfileandname(char *fname, size_t len)
   }
 #else
   {
-    /* try with /usr/tmp and /tmp on Un*x systems */
+    /* try with /tmp and /var/tmp on Un*x systems */
     struct stat statbuf;
 
     if (tmpdir == NULL) {
-      if (stat("/usr/tmp", &statbuf) != -1)
-        tmpdir = "/usr/tmp";
-      else if (stat("/tmp", &statbuf) != -1)
+      if (stat("/tmp", &statbuf) != -1)
         tmpdir = "/tmp";
+      else if (stat("/var/tmp", &statbuf) != -1)
+        tmpdir = "/var/tmp";
     }
   }
 #endif
index 7ac65fa606e6a967d68fae07d962785d5d64dae2..d0cc08d765dbc4eb724806b9c88917078d21ee44 100644 (file)
@@ -243,3 +243,16 @@ testUMinus(void)
   sc = -128;
   ASSERT(-sc == 128);
 }
+
+void
+testBug1571231(void)
+{
+  unsigned char  {attrL} uc;
+
+  /* bug-1571231 */
+  uc = 0x80;
+  if (uc + 0x80)
+    ASSERT(1);
+  else
+    ASSERT(0);
+}