Inconsistent Warning Message C2705

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Inconsistent Warning Message C2705

422 Views
rayhall
Contributor V

Hello,

 

I am getting this warning only for some of basically the same code. "Warning C2750: Possible loss of data"

I can disable the message, but would prefer not to do this. What is wrong ?

 

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C0F_MASK); // No warning

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C1F_MASK); // No warning

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C2F_MASK); // No warning

 

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C3F_MASK); // Get Warning C2705

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C4F_MASK); // Get Warning C2705

 

TIM_TFLG1 &= ~(1<<TIM_TFLG1_C5F_MASK); // No warning

 

The micro is the S12XE.

 

Ray.

Labels (1)
0 Kudos
1 Reply

245 Views
TICS_Fiona
NXP Employee
NXP Employee

Hello Ray

What is the data type of TIM_TFLG1_C0F_MASK~ TIM_TFLG1_C5F_MASK, and what is the data type of TIM_TFLG1?   We need to the code context to dig out the reason.

By default, the compiler uses 16bit for the operand “1”of the <<operator in your code. So please add the typecast for this kind of operation to get rid of the warning.

Best Regards

Fiona Kuang

TIC - Technical Information Center

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Mark Correct button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos