This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ULP advisor 14.1 not detected correctly

Hi folks,

In CCSv6.1.3.00034 I have come across an issue with a ULP advisor rule 14.1 (marked as #2553-D, though I'm not sure what that refers to)

I have a 16-bit  integer declared using the stdint.h data type (i.e. int16_t i = 0;) that is used as an array index.

Yet when used, ULP advises that: " Array index (involving "i") of type "int16_t". Recommend using "int16_t"", which of course seems to state that int16_t is incorrect because it's not int16_t... which is obviously nonsensical.

I take it it's looking for use of a particular definition of int16_t maybe?

Furthermore, is a size_t type not the C recommended type to use for indexing arrays?

  • The diagnostic is correctly issued, but the wording is wrong.  The full story is on this wiki page.  In short, unsigned array index variables work better than signed ones.  I filed CODEGEN-1545 in the SDOWP system to have this investigated.  You are welcome to follow it with the SDOWP link below in my signature.

    Toby Mole said:
    is a size_t type not the C recommended type to use for indexing arrays?

    The type size_t is unsigned, so it works well as an array index variable type.

    Thanks and regards,

    -George

  • George,

    Many thanks for the info and for filling the bug.