RE: How to fix 'array subscript is above array bounds' ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux