From 308ceeacf9594a77a2e8b2e56c308e521bd717b6 Mon Sep 17 00:00:00 2001 From: uz Date: Sun, 28 Dec 2008 16:25:03 +0000 Subject: [PATCH] Fixed problems with casts, where larger values weren't truncated when casting down to char size. git-svn-id: svn://svn.cc65.org/cc65/trunk@3904 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/expr.c | 4 ++-- src/cc65/typeconv.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 6fb2d5e27..a880dbdbe 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -2929,8 +2929,8 @@ static void addsubeq (const GenDesc* Gen, ExprDesc *Expr) } /* Setup the code generator flags */ - lflags |= TypeOf (Expr->Type) | GlobalModeFlags (Expr) | CF_FORCECHAR; - rflags |= TypeOf (Expr2.Type); + lflags |= TypeOf (Expr->Type) | GlobalModeFlags (Expr); + rflags |= TypeOf (Expr2.Type) | CF_FORCECHAR; /* Convert the type of the lhs to that of the rhs */ g_typecast (lflags, rflags); diff --git a/src/cc65/typeconv.c b/src/cc65/typeconv.c index 57313457d..86c07ec88 100644 --- a/src/cc65/typeconv.c +++ b/src/cc65/typeconv.c @@ -102,7 +102,7 @@ static void DoConversion (ExprDesc* Expr, const Type* NewType) LoadExpr (CF_NONE, Expr); /* Emit typecast code */ - g_typecast (TypeOf (NewType), TypeOf (OldType)); + g_typecast (TypeOf (NewType), TypeOf (OldType) | CF_FORCECHAR); /* Value is now in primary and an rvalue */ ED_MakeRValExpr (Expr); @@ -148,7 +148,7 @@ static void DoConversion (ExprDesc* Expr, const Type* NewType) LoadExpr (CF_NONE, Expr); /* Emit typecast code. */ - g_typecast (TypeOf (NewType) | CF_FORCECHAR, TypeOf (OldType)); + g_typecast (TypeOf (NewType), TypeOf (OldType) | CF_FORCECHAR); /* Value is now a rvalue in the primary */ ED_MakeRValExpr (Expr); -- 2.39.5