On Sun, 20 Apr 2008, Lorenzo Fiorini wrote:
> Here are the "few" warnings I get building harbour under Fedora 9
> preview with gcc (GCC) 4.3.0 20080416 (Red Hat 4.3.0-7)
> ../../hbstr.c: In function 'hb_numRound':
> ../../hbstr.c:340: warning: array subscript is below array bounds
> ../../hbstr.c: In function 'hb_numDecConv':
> ../../hbstr.c:340: warning: array subscript is below array bounds
It's a wrong compiler warning messages. I hope that it generates
valid machine code.
The warning comes from code:
if( nPrecision < 16 )
{
if( nPrecision >= 0 )
{
return s_dPow10[ nPrecision ];
}
else if( nPrecision > -16 )
{
return 1.0 / s_dPow10[ -nPrecision ]; // line 340
}
}
and s_dPow10 has 16 elements (indexed from 0 to 15). So as you can see
array bounds cannot be exceed.
I do not have GCC 4.3 so I cannot check what is the exact source of
this message but if you have a while then you can try to pacify this
warning.
First you can try to change:
nPrecision < 16
to:
nPrecision <= 15
and:
nPrecision > -16
to:
nPrecision >= -15
but I do not expect it will help.
Probably explicit casting in line 340 should help:
return 1.0 / s_dPow10[ ( unsigned int ) -nPrecision ];
best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour