From 12a91c6e12bc77f88d3aa1b2ccbbd538be073d2e Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Mon, 7 Jul 2008 10:49:22 +0000 Subject: [PATCH] 2008-07-07 12:48 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/compiler/gencc.c ! fixed bud with wrong C code generated for doubly negated integer values reported by Viktor. --- harbour/ChangeLog | 5 +++++ harbour/source/compiler/gencc.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 58daaa642f..cefd2e85b6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,11 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-07-07 12:48 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/compiler/gencc.c + ! fixed bud with wrong C code generated for doubly negated integer + values reported by Viktor. + 2008-07-07 06:57 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * make_deb.sh + Added libgpm-dev to mouse test. Thanks Guy. diff --git a/harbour/source/compiler/gencc.c b/harbour/source/compiler/gencc.c index 768fa48b93..81cedf5258 100644 --- a/harbour/source/compiler/gencc.c +++ b/harbour/source/compiler/gencc.c @@ -198,13 +198,18 @@ static int hb_gencc_checkNumAhead( LONG lValue, PFUNCTION pFunc, ULONG lPCodePos fprintf( cargo->yyc, "\tif( hb_xvmDivideByInt( %ld ) ) break;\n", lValue ); return 1; + case HB_P_MINUS: + if( lValue > 0 ) + { + fprintf( cargo->yyc, "\tif( hb_xvmAddInt( -%ld ) ) break;\n", lValue ); + return 1; + } + lValue = -lValue; + /* no break */ + case HB_P_PLUS: fprintf( cargo->yyc, "\tif( hb_xvmAddInt( %ld ) ) break;\n", lValue ); return 1; - - case HB_P_MINUS: - fprintf( cargo->yyc, "\tif( hb_xvmAddInt( -%ld ) ) break;\n", lValue ); - return 1; } } return 0;