From: bernhardheld Date: Fri, 6 Oct 2006 20:50:56 +0000 (+0000) Subject: * src/SDCCglue.c (tempfileandname): changed un*x tmp search paths to /tmp and /var... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=43cc70abc15aaff182ca2b79a81a5c1b9e4cee24;p=fw%2Fsdcc * 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 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4403 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 28eb2601..56a0ceaa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-10-06 Bernhard Held + + * 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 * src/mcs51/gen.c: emitcode for "add a,0x%02x" requires only 8 bits. diff --git a/src/SDCCast.c b/src/SDCCast.c index f57bc148..99582eef 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -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; diff --git a/src/SDCCglue.c b/src/SDCCglue.c index 7cee8eb5..a4b8d4f8 100644 --- a/src/SDCCglue.c +++ b/src/SDCCglue.c @@ -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 diff --git a/support/regression/tests/onebyte.c b/support/regression/tests/onebyte.c index 7ac65fa6..d0cc08d7 100644 --- a/support/regression/tests/onebyte.c +++ b/support/regression/tests/onebyte.c @@ -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); +}