From 7b0cd93b7bd04b332f409c2ece675f3943bbd70a Mon Sep 17 00:00:00 2001 From: johanknol Date: Mon, 24 Feb 2003 15:32:12 +0000 Subject: [PATCH] fixed bug#680076 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2306 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCast.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/SDCCast.c b/src/SDCCast.c index fe878f9f..4db1c15b 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -2895,10 +2895,17 @@ decorateType (ast * tree) /* if they are pointers they must be castable */ if (IS_PTR (LTYPE (tree)) && IS_PTR (RTYPE (tree))) { + if (tree->opval.op==EQ_OP && + !IS_GENPTR(LTYPE(tree)) && IS_GENPTR(RTYPE(tree))) { + // we cannot cast a gptr to a !gptr: switch the leaves + struct ast *s=tree->left; + tree->left=tree->right; + tree->right=s; + } if (compareType (LTYPE (tree), RTYPE (tree)) == 0) { werror (E_COMPARE_OP); - fprintf (stderr, "comparing type "); + fprintf (stderr, "comparring type "); printTypeChain (LTYPE (tree), stderr); fprintf (stderr, "to type "); printTypeChain (RTYPE (tree), stderr); -- 2.39.5