From 2ceac874f6c59f9a9ff23d72eb06b5c519ea409c Mon Sep 17 00:00:00 2001 From: johanknol Date: Wed, 5 Dec 2001 20:06:13 +0000 Subject: [PATCH] fixed bug #489360 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1662 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCsymt.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SDCCsymt.c b/src/SDCCsymt.c index ec3386e2..db8e3ad9 100644 --- a/src/SDCCsymt.c +++ b/src/SDCCsymt.c @@ -783,7 +783,13 @@ getSize (sym_link * p) switch (DCL_TYPE (p)) { case ARRAY: - return DCL_ELEM (p) * getSize (p->next); + if (DCL_ELEM(p)) { + return DCL_ELEM (p) * getSize (p->next); + } else { + werror (E_INTERNAL_ERROR, __FILE__, __LINE__, + "can not tell the size of an array[]"); + return 0; + } case IPOINTER: case PPOINTER: case POINTER: @@ -1410,11 +1416,11 @@ computeType (sym_link * type1, sym_link * type2) else if (IS_BITVAR (etype2) && !IS_BITVAR (etype1)) rType = copyLinkChain (type1); else - /* if one of them is a pointer then that + /* if one of them is a pointer or array then that prevails */ - if (IS_PTR (type1)) + if (IS_PTR (type1) || IS_ARRAY (type1)) rType = copyLinkChain (type1); - else if (IS_PTR (type2)) + else if (IS_PTR (type2) || IS_ARRAY (type2)) rType = copyLinkChain (type2); else if (getSize (type1) > getSize (type2)) rType = copyLinkChain (type1); -- 2.39.5