From: cuz Date: Wed, 6 Mar 2002 06:38:48 +0000 (+0000) Subject: Fixed several const related bugs X-Git-Tag: V2.12.0~2448 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0a4799c975b7e7fdaad33df3e89862df6a2b5859;p=cc65 Fixed several const related bugs git-svn-id: svn://svn.cc65.org/cc65/trunk@1165 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/expr.c b/src/cc65/expr.c index e272bba98..f0bc0d8d9 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -2280,7 +2280,7 @@ static void parsesub (int k, ExprDesc* lval) /* Operate on pointers, result type is a pointer */ } else if (IsClassPtr (lhst) && IsClassPtr (rhst)) { /* Left is pointer, right is pointer, must scale result */ - if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_EQUAL) { + if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) { Error ("Incompatible pointer types"); } else { lval->ConstVal = (lval->ConstVal - lval2.ConstVal) / PSizeOf (lhst); @@ -2315,7 +2315,7 @@ static void parsesub (int k, ExprDesc* lval) flags = CF_PTR; } else if (IsClassPtr (lhst) && IsClassPtr (rhst)) { /* Left is pointer, right is pointer, must scale result */ - if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_EQUAL) { + if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) { Error ("Incompatible pointer types"); } else { rscale = PSizeOf (lhst); @@ -2358,7 +2358,7 @@ static void parsesub (int k, ExprDesc* lval) flags = CF_PTR; } else if (IsClassPtr (lhst) && IsClassPtr (rhst)) { /* Left is pointer, right is pointer, must scale result */ - if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_EQUAL) { + if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) { Error ("Incompatible pointer types"); } else { rscale = PSizeOf (lhst); @@ -3025,7 +3025,7 @@ static void Assignment (ExprDesc* lval) g_push (CF_PTR | CF_UNSIGNED, 0); /* Check for equality of the structs */ - if (TypeCmp (ltype, lval2.Type) < TC_EQUAL) { + if (TypeCmp (ltype, lval2.Type) < TC_STRICT_COMPATIBLE) { Error ("Incompatible types"); }