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.

CCS/CC3200: CC3200 and Code Composer: No warning of overflow

Part Number: CC3200

Tool/software: Code Composer Studio

Device: CC3200 servicepack_1.0.1.6-2.7.0.0

Compiler: Code Composer Studio  Version: 6.2.0.00050 

I just noticed that I am not getting a warning when an overflow occurs.

void main(void)

{

unsigned char a = 0;

unsigned short b = 65535;

a = b;   <-- Overflow, but no warnings!

...

}

The only warning I get is: " #552-D variable "a" was set but never used."

a = 255. 

I searched the console output to no avail.

Settings in "Project\Properties\Build\ARM Linker\Advanced Options\Diagnotics"    -- All Clear

I thought I seen overflow warnings in the past. This clearly is an overflow, so what gives?

Thank you,

Chris.

  • By default, the TI compiler does very few static checks for problems.  There are many other tools which specialize in that task.  A web search for static code analysis shows many possibilities to consider.  

    That said, there is one feature in the compiler that can help.  This particular problem does get a diagnostic if you use the option --check_misra=10.1.

    C:\work\dir>armcl --check_misra=10.1 file.c
    "file.c", line 3: warning: (MISRA-C:2004 10.1/R) The value of an expression of integer type shall not be implicitly converted to a different underlying type if it is not a conversion to a wider integer type of the same signedness
    "file.c", line 4: warning: (MISRA-C:2004 10.1/R) The value of an expression of integer type shall not be implicitly converted to a different underlying type if it is not a conversion to a wider integer type of the same signedness
    "file.c", line 5: warning: (MISRA-C:2004 10.1/R) The value of an expression of integer type shall not be implicitly converted to a different underlying type if it is not a conversion to a wider integer type of the same signedness
    "file.c", line 3: warning: variable "a" was set but never used

    Thanks and regards,

    -George