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.

Compiler/TMS320C6674: Enumeration "pointless comparison of unsigned integer" warning in compiler v8.2.1

Part Number: TMS320C6674

Tool/software: TI C/C++ Compiler

Hello, I created this simple C file to demonstrate my question:

#include <stdint.h>

typedef enum
{
	ENUM_VALUE_0,
	ENUM_VALUE_1,
	ENUM_VALUE_2,
} MyEnum_t;

extern volatile int32_t myInteger;

int main(void)
{
	MyEnum_t enumValue = (MyEnum_t)myInteger;

	if ((enumValue >= ENUM_VALUE_0) && (enumValue <= ENUM_VALUE_2))
	{
		// Valid choice!
	}

	return 0;
}

This gives the compiler output:

**** Build of configuration Debug for project enumTest ****

"C:\\ti\\ccsv7\\utils\\bin\\gmake" -k -j 7 all -O
'Building file: ../main.c'
'Invoking: C6000 Compiler'
"C:/ti/ccsv7/tools/compiler/ti-cgt-c6000_8.2.1/bin/cl6x" -mv6600 --include_path="C:/ti/ccsv7/tools/compiler/ti-cgt-c6000_8.2.1/include" -g --c99 --verbose_diagnostics --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
"../main.c", line 16: warning: pointless comparison of unsigned integer with zero
if ((enumValue >= ENUM_VALUE_0) && (enumValue <= ENUM_VALUE_2))
               ^

I don't understand why this warning is being generated for my enumeration, because according to section 7.4.1, "Size of Enum Types," in SPRUI04B:

"For C++ and relaxed C89/C99, the compiler allows enumeration constants up to the largest integral type
(64 bits). The default, which is recommended, is for the underlying type to be the first type in the following
list in which all the enumerated constant values can be represented: int, unsigned int, long long, unsigned
long long."

I am interpreting that quote to mean that the underlying type for my enumeration should be an int, because all of the enumerated constant values (in this case, 0, 1, and 2) can be represented in an int. But the warning seems to indicate that the underlying type is unsigned.

Please let me know where I am misunderstanding this. Thanks in advance for your help!

Best regards,
Dave