From 37157a31a885e82ca2bf52f6c8a015e20043b174 Mon Sep 17 00:00:00 2001 From: uz Date: Thu, 30 Jul 2009 14:45:50 +0000 Subject: [PATCH] Fixed problems with R3977: While the solution was correct, the generated code is bad, since information is lost when converting functions and arrays to pointers and cannot be regained easily. So I've reverted the change and fixed the problem in a less general manner. git-svn-id: svn://svn.cc65.org/cc65/trunk@3984 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/expr.c | 4 +++- src/cc65/loadexpr.c | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 7f40651bf..d12bdb44f 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -2683,6 +2683,7 @@ static void hieQuest (ExprDesc* Expr) /* Load it into the primary */ LoadExpr (CF_NONE, &Expr2); ED_MakeRValExpr (&Expr2); + Expr2.Type = PtrConversion (Expr2.Type); } labt = GetLocalLabel (); ConsumeColon (); @@ -2700,6 +2701,7 @@ static void hieQuest (ExprDesc* Expr) /* Load it into the primary */ LoadExpr (CF_NONE, &Expr3); ED_MakeRValExpr (&Expr3); + Expr3.Type = PtrConversion (Expr3.Type); } /* Check if any conversions are needed, if so, do them. @@ -2842,7 +2844,7 @@ static void opeq (const GenDesc* Gen, ExprDesc* Expr) g_inc (flags | CF_CONST, Expr2.IVal); } else if (Gen->Func == g_sub) { g_dec (flags | CF_CONST, Expr2.IVal); - } else { + } else { if (Expr2.IVal == 0) { /* Check for div by zero/mod by zero */ if (Gen->Func == g_div) { diff --git a/src/cc65/loadexpr.c b/src/cc65/loadexpr.c index 6e3a9b6fd..faeec06ba 100644 --- a/src/cc65/loadexpr.c +++ b/src/cc65/loadexpr.c @@ -172,10 +172,6 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr) } } - /* Do standard pointer conversions since the expression is now in the - * primary. - */ - Expr->Type = PtrConversion (Expr->Type); }