How to fix 'array subscript is above array bounds' ?
David Aldrich
David.Aldrich@EMEA.NEC.COM
Tue Apr 3 16:22:00 GMT 2012
Hi
Actually I have a harder example of this warning to fix. What should one do in this situation please?
unsigned rsCodeTable( unsigned a_rsGroup, unsigned a_sc )
{
static const unsigned PUCCHIP_RSCodeTable[30][12] = {
{2, 1, 0, 3, 0, 0, 1, 1, 0, 1, 3, 0},
{1, 1, 0, 0, 0, 2, 1, 3, 3, 1, 3, 0},
{1, 1, 3, 3, 3, 2, 3, 3, 1, 3, 1, 2},
{2, 1, 1, 1, 1, 2, 3, 3, 1, 3, 0, 2},
{2, 0, 1, 2, 1, 2, 3, 2, 1, 2, 1, 0},
{1, 3, 0, 2, 2, 1, 1, 2, 2, 0, 3, 1},
{2, 0, 3, 3, 3, 0, 1, 2, 0, 0, 3, 1},
{3, 2, 2, 2, 1, 3, 0, 2, 1, 3, 0, 1},
{1, 3, 0, 1, 2, 2, 2, 1, 1, 0, 2, 1},
{1, 3, 2, 0, 0, 2, 3, 1, 1, 1, 1, 1},
{2, 0, 2, 1, 1, 3, 3, 2, 3, 3, 0, 2},
{0, 1, 2, 2, 0, 0, 3, 1, 0, 1, 0, 0},
{1, 3, 1, 1, 3, 1, 1, 1, 3, 3, 3, 1},
{0, 0, 3, 0, 3, 1, 1, 0, 2, 3, 0, 0},
{3, 1, 2, 3, 2, 0, 1, 0, 0, 0, 2, 1},
{0, 2, 1, 3, 2, 2, 1, 1, 0, 1, 2, 3},
{1, 0, 1, 2, 1, 0, 0, 0, 2, 2, 0, 2},
{3, 1, 1, 0, 3, 0, 3, 3, 0, 1, 0, 2},
{3, 0, 1, 1, 3, 1, 3, 3, 2, 2, 1, 3},
{2, 0, 1, 0, 1, 2, 2, 0, 3, 2, 3, 2},
{2, 3, 1, 1, 1, 1, 0, 1, 2, 1, 3, 2},
{2, 0, 2, 1, 3, 3, 3, 3, 3, 1, 2, 3},
{1, 1, 3, 3, 3, 3, 2, 0, 3, 1, 3, 0},
{1, 1, 2, 3, 2, 3, 1, 2, 1, 0, 2, 1},
{1, 1, 0, 1, 0, 0, 2, 1, 2, 3, 3, 1},
{1, 3, 0, 0, 1, 0, 0, 1, 3, 2, 2, 0},
{1, 0, 3, 3, 0, 3, 1, 2, 2, 0, 2, 3},
{3, 2, 3, 2, 3, 0, 1, 2, 1, 0, 3, 3},
{2, 0, 3, 0, 2, 0, 0, 3, 0, 0, 2, 2},
{0, 3, 3, 2, 2, 3, 2, 0, 3, 0, 1, 2} };
if ( a_rsGroup >= 30 ) fatal("PUCCHIP::rsCodeTable() : Illegal RS group number");
if ( a_sc >= 12 ) fatal("PUCCHIP::rsCodeTable() : Illegal subcarrier number");
return PUCCHIP_RSCodeTable[a_rsGroup][a_sc]; <<== WARNING 'array subscript is above array bounds'
}
Best regards
David
More information about the Gcc-help
mailing list