From 4e0794235abb8298c752250b0c567aeb79e7a356 Mon Sep 17 00:00:00 2001 From: epetrich Date: Sat, 2 Apr 2005 07:06:41 +0000 Subject: [PATCH] * src/SDCCicode.c (getArraySizePtr): fixed bug #1122171 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3713 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++++ src/SDCCicode.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fdad47e3..d4045900 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-04-02 Erik Petrich + + * src/SDCCicode.c (getArraySizePtr): fixed bug #1122171 + 2005-04-01 Erik Petrich * device/include/Makefile.in: add support for hc08 subdirectory diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 334ff8d8..a0289d04 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -1786,7 +1786,7 @@ getArraySizePtr (operand * op) if(IS_PTR(ltype)) { int size = getSize(ltype); - return(IS_GENPTR(ltype)?(size-1):size); + return((IS_GENPTR(ltype) && GPTRSIZE > FPTRSIZE) ? (size-1) : size); } if(IS_ARRAY(ltype)) @@ -1804,7 +1804,10 @@ getArraySizePtr (operand * op) case FUNCTION: return (FPTRSIZE); case GPOINTER: - return (GPTRSIZE-1); + if (GPTRSIZE > FPTRSIZE) + return (GPTRSIZE-1); + else + return (FPTRSIZE); default: return (FPTRSIZE); -- 2.30.2