Hello Przemek

Przemyslaw Czerpak-2 wrote:
> 
> /* compiled and linked by PellesC 4.50.15:
>  *    pocc.exe -Ox test.c && polink.exe t.obj
>  */
> 
> void * somefunc( void ) { return 0; }
> 
> void * func_ok( void )
> {
>    void ** gtHolder = ( void ** ) somefunc();
> 
>    if( gtHolder )
>       return *gtHolder;
>    else
>       return 0;
> }
> 
> void * func_gpf( void )
> {
>    void ** gtHolder = ( void ** ) somefunc();
>    void * pGT = 0;
> 
>    if( gtHolder )
>       pGT = *gtHolder;
>    return pGT;
> }
> 
> int main( void )
> {
>    func_ok();
>    func_gpf();
> 
>    return 0;
> }
> 

Here is the reply of Pelle Orinius:

Hello, 

> Here is self contained C code which GPFs. OK, thanks. The -Ox option will
> enable Pentium Pro+ instructions, and enable -Ot (optimize for speed) -
> since neither -Os nor -Ot was specified. The problem is with one of the
> Pentium Pro+ instructions (conditional move), that will evaluate *all* of
> it's operands - even if they are not all used in the end, i.e. the move is
> actually performed. If one of the operands is an invalid address, it will
> GPF. Bummer. 

Version 4.50 is old, so I will not make any more bug-fixes in that version.
I will look at fixing this in the current version, 5.00. 

When it comes to optimizations, the -Ot option (in this case) is the much
more important than -Ox. The -Ox option will only rarely find things to
optimize, and in your case it will cause a GPF. I suggest you skip the -Ox
option and just use the -Ot option for now... 

Pelle 



Regards
Pritpal Bedi


-- 
View this message in context: 
http://www.nabble.com/hb_gt_ItemBase%28%29-and-PellesC-tp22344045p22375824.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to