1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00

A constant right side does not necessarily mean that no code is generated for

the right side. The expression may have had side effects. This error is also
found in several other places.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4129 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-09-07 14:22:27 +00:00
parent b2d30c3283
commit f5ca779b9b

View File

@ -163,6 +163,8 @@ void Assignment (ExprDesc* Expr)
CodeMark AndPos;
CodeMark PushPos;
CodeMark RhsPos;
CodeMark RhsEndPos;
unsigned Mask;
unsigned Flags;
@ -194,15 +196,20 @@ void Assignment (ExprDesc* Expr)
g_push (Flags, 0);
/* Read the expression on the right side of the '=' */
GetCodePos (&RhsPos);
hie1 (&Expr2);
GetCodePos (&RhsEndPos);
/* Do type conversion if necessary. Beware: Do not use char type
* here!
*/
TypeConversion (&Expr2, ltype);
/* Special treatment if the value is constant */
if (ED_IsConstAbsInt (&Expr2)) {
/* Special treatment if the value is constant. */
/* Beware: Expr2 may contain side effects, so there must not be
* code generated for Expr2.
*/
if (ED_IsConstAbsInt (&Expr2) && CodeRangeIsEmpty (&RhsPos, &RhsEndPos)) {
/* Get the value and apply the mask */
unsigned Val = (unsigned) (Expr2.IVal & Mask);