From 40a3694e493bc411b4625ccce7c5804474f7b9af Mon Sep 17 00:00:00 2001 From: epetrich Date: Fri, 21 May 2004 07:09:29 +0000 Subject: [PATCH] * src/SDCCopt.c (killDeadCode): fixed bug #907733 * support/Util/SDCCerr: reworded E_AUTO_ASSUMED diagnostic to clarify that the variable, not the function, should be static * src/SDCCval.c (valCastLiteral): fixed bit initialization from literal to be consistent with non-literal case git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3321 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 8 ++++++++ src/SDCCopt.c | 13 ++++++++++++- src/SDCCval.c | 2 +- support/Util/SDCCerr.c | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1cd2ef0..a48e4aea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-05-21 Erik Petrich + + * src/SDCCopt.c (killDeadCode): fixed bug #907733 + * support/Util/SDCCerr.c: reworded E_AUTO_ASSUMED diagnostic to clarify + that the variable, not the function, should be static + * src/SDCCval.c (valCastLiteral): fixed bit initialization from literal + to be consistent with non-literal case + 2004-05-19 Erik Petrich * src/SDCCast.c (isConformingBody): fixed bug #949967 diff --git a/src/SDCCopt.c b/src/SDCCopt.c index e76e30f3..94ee6e18 100644 --- a/src/SDCCopt.c +++ b/src/SDCCopt.c @@ -883,7 +883,8 @@ killDeadCode (eBBlock ** ebbs, int count) if (IC_RESULT (ic) && POINTER_SET (ic)) continue; - if (POINTER_GET (ic) && IS_VOLATILE (operandType (IC_LEFT (ic))->next)) + if (POINTER_GET (ic) && IS_VOLATILE (operandType (IC_LEFT (ic))->next) + && !SPIL_LOC (IC_RESULT (ic))) continue; /* if the result is used in the remainder of the */ @@ -947,6 +948,16 @@ killDeadCode (eBBlock ** ebbs, int count) volRight = FALSE; } + if (POINTER_GET (ic) && IS_VOLATILE (operandType (IC_LEFT (ic))->next)) + { + if (SPIL_LOC (IC_RESULT (ic))) + { + IC_RESULT (ic) = newiTempFromOp (IC_RESULT (ic)); + SPIL_LOC (IC_RESULT (ic)) = NULL; + } + continue; + } + change = 1; gchange++; diff --git a/src/SDCCval.c b/src/SDCCval.c index 96c962a5..6b18f5ea 100644 --- a/src/SDCCval.c +++ b/src/SDCCval.c @@ -1574,7 +1574,7 @@ valCastLiteral (sym_link * dtype, double fval) SPEC_CVAL (val->etype).v_float = fval; else if (SPEC_NOUN (val->etype) == V_BIT || SPEC_NOUN (val->etype) == V_SBIT) - SPEC_CVAL (val->etype).v_uint = l & 1; + SPEC_CVAL (val->etype).v_uint = l ? 1 : 0; else if (SPEC_NOUN (val->etype) == V_BITFIELD) SPEC_CVAL (val->etype).v_uint = l & (0xffffu >> (16 - SPEC_BLEN (val->etype))); diff --git a/support/Util/SDCCerr.c b/support/Util/SDCCerr.c index 7f3b8a76..ac00fa6c 100644 --- a/support/Util/SDCCerr.c +++ b/support/Util/SDCCerr.c @@ -85,7 +85,7 @@ struct { W_INIT_IGNORED, ERROR_LEVEL_WARNING, "Variable in the storage class cannot be initialized.'%s'" }, { E_AUTO_ASSUMED, ERROR_LEVEL_ERROR, - "storage class not allowed for automatic variable '%s' in reentrant function unless static" }, + "variable '%s' must be static to have storage class in reentrant function" }, { E_AUTO_ABSA, ERROR_LEVEL_ERROR, "absolute address not allowed for automatic var '%s' in reentrant function " }, { W_INIT_WRONG, ERROR_LEVEL_WARNING, -- 2.30.2