From 7b648ebc7eb546061da9287dbc0f963e8abb3dc3 Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Thu, 4 May 2000 11:05:09 +0000 Subject: [PATCH] 20000504-04:05 GMT-8 Ron Pinkas * source/compiler/hbpcode.c ! Fixed GPF when Array of 0 elements created. --- harbour/ChangeLog | 5 +++++ harbour/source/compiler/hbpcode.c | 16 ++++++++++++---- harbour/tests/testwarn.prg | 26 +++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 39bd92565a..0e468b61d3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,8 @@ +20000504-04:05 GMT-8 Ron Pinkas + + * source/compiler/hbpcode.c + ! Fixed GPF when Array of 0 elements created. + 20000504-03:10 GMT-8 Ron Pinkas * source/compiler/harbour.l diff --git a/harbour/source/compiler/hbpcode.c b/harbour/source/compiler/hbpcode.c index 6805623381..379ff7fa3c 100644 --- a/harbour/source/compiler/hbpcode.c +++ b/harbour/source/compiler/hbpcode.c @@ -772,8 +772,12 @@ void hb_compStrongType( int iSize ) /* TODO Error Message after finalizing all possible pcodes. */ break; - cType = pFunc->pStack[ pFunc->iStackIndex - 1 ]; - while ( --wVar ) + if ( wVar ) + cType = pFunc->pStack[ pFunc->iStackIndex - 1 ]; + else + cType = 'A'; + + while ( --wVar > 0 ) { pFunc->iStackIndex--; @@ -799,8 +803,12 @@ void hb_compStrongType( int iSize ) /* TODO Error Message after finalizing all possible pcodes. */ break; - cType = pFunc->pStack[ pFunc->iStackIndex - 1 ]; - while ( --wVar ) + if ( wVar ) + cType = pFunc->pStack[ pFunc->iStackIndex - 1 ]; + else + cType = 'A'; + + while ( --wVar > 0 ) { pFunc->iStackIndex--; diff --git a/harbour/tests/testwarn.prg b/harbour/tests/testwarn.prg index 5e49b79981..275dec461b 100644 --- a/harbour/tests/testwarn.prg +++ b/harbour/tests/testwarn.prg @@ -61,12 +61,36 @@ DECLARE FUNCTION int( n AS NUMERIC ) AS NUMERIC DECLARE FUNCTION TEST AS NUMERIC -PROCEDURE MAIN( Param1 ) + +PROCEDURE MAINA( ) + LOCAL GetList := {} + + Getlist[ 1 ]:postBlock := LI_VALID[ fipos ] + +RETURN + +PROCEDURE MAIN( ) LOCAL cVar as char, a[2,3,4] AS BOOL ARRAY LOCAL RPT, APARAMS + LOCAL rezproc, xkey, rez, fipos, wndbuf, oldcolors, ym, xm, i + LOCAL prview, prsohr, predit, predxx + LOCAL fbar1, fbar2, vartmp, varbuf + //LOCAL GetList := {} + +#ifdef VER_MOUSE + PARAMETERS x1,y1,x2,y2,title,maskey,ctrl_ar +#else + //PARAMETERS x1,y1,x2,y2,title,maskey +#endif + + IF ( ym <= y1 )//.OR. ym >= y2 .OR. xm <= x1 .OR. xm >= x2 ) + IF xm <= x2 .AND. xm >= x1 .AND. ( ym = y1 .OR. ym = y2 ) + ENDIF + ENDIF + a[1] = 2 cVAr := a[1]