From fb4770d8a18c085390904132e346caf2d9a72c9f Mon Sep 17 00:00:00 2001 From: bernhardheld Date: Sun, 18 Jan 2004 21:37:55 +0000 Subject: [PATCH] * src/SDCCval.c (cheapestVal): added missing checks * src/SDCCicode.c (usualBinaryConversions): fixed condition * src/SDCCicode.c (geniCodeAdd): fixed part of bug #877103 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3139 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 12 +++++++++--- src/SDCCicode.c | 18 +++++++++++++----- src/SDCCval.c | 3 +++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index d974bea6..56c03838 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-01-18 Bernhard Held + + * src/SDCCval.c (cheapestVal): added missing checks + * src/SDCCicode.c (usualBinaryConversions): fixed condition + * src/SDCCicode.c (geniCodeAdd): fixed part of bug #877103 + 2004-01-16 Klaus Flittner * src/ds390/gen.c (aopOp3): fixed the assignment of different dptrs to @@ -18,7 +24,7 @@ to Pics16. Updated all references to them. * src/pic16/glue.c (pic16glue): corrected bug with code initialization which bypassed the variable initializations block. - + * device/lib/pic16/Makefile.rules: removed --penable-stack from COMPILE_FLAGS and added the --nostdinc option @@ -48,11 +54,11 @@ files into pic16 directory * in target 'installdirs' added line to create directory pic16 in the installation path - + * device/include/Makefile.in (version 1.11): in target 'install' added lines to copy all header files to installation path, * in target 'installdirs' added line create directory for pic16 - headers in the installation path + headers in the installation path 2004-01-13 Klaus Flittner diff --git a/src/SDCCicode.c b/src/SDCCicode.c index f19f4129..8671e2ad 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -1764,12 +1764,19 @@ usualBinaryConversions (operand ** op1, operand ** op2, This if for 'mul a,b', which takes two chars and returns an int */ if ( isMul /* && promoteCharToInt superfluous, already handled by computeType() */ - && IS_CHAR (getSpec (ltype)) - && IS_CHAR (getSpec (rtype)) - && !(IS_UNSIGNED (getSpec (rtype)) ^ IS_UNSIGNED (getSpec (ltype))) && IS_INT (getSpec (ctype))) - return ctype; + { + sym_link *retype = getSpec (rtype); + sym_link *letype = getSpec (ltype); + if ( IS_CHAR (letype) + && IS_CHAR (retype) + && IS_UNSIGNED (letype) + && IS_UNSIGNED (retype)) + { + return ctype; + } + } *op1 = geniCodeCast (ctype, *op1, TRUE); *op2 = geniCodeCast (ctype, *op2, TRUE); @@ -2216,6 +2223,7 @@ geniCodeAdd (operand * left, operand * right, int lvl) if (getSize (ltype->next) != 1) { size = operandFromLit (getSize (ltype->next)); + SPEC_USIGN (getSpec (operandType (size))) = 1; indexUnsigned = IS_UNSIGNED (getSpec (operandType (right))); right = geniCodeMultiply (right, size, (getArraySizePtr(left) >= INTSIZE)); /* Even if right is a 'unsigned char', @@ -3778,7 +3786,7 @@ ast2iCode (ast * tree,int lvl) return geniCodeDerefPtr (geniCodeRValue (left, FALSE),lvl); case '-': - if (right) + if (right) return geniCodeSubtract (geniCodeRValue (left, FALSE), geniCodeRValue (right, FALSE)); else diff --git a/src/SDCCval.c b/src/SDCCval.c index 7657be6b..6d1e5cc9 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -374,6 +374,9 @@ static value *cheapestVal (value *val) { static value *cheapestVal (value *val) { + if (IS_FLOAT (val->type) || IS_CHAR (val->type)) + return val; + /* - signed/unsigned must not be changed. - long must not be changed. -- 2.47.2