Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 436
 2012 Microchip Technology Inc.
(754) bitfield comparison out of range 
(Code Generator)
This is the result of comparing a bit-field with a value when the value is out of range of 
the bit-field. That is, comparing a 2-bit bit-field to the value 5 will never be true as a 2-bit 
bit-field has a range from 0 to 3. For example:
struct {
  unsigned mask : 2;  /* mask can hold values 0 to 3 */
} value;
int compare(void)
{
  return (value.mask == 6);  /* test can
}  
(755) divide by zero 
(Code Generator)
A constant expression that was being evaluated involved a division by zero, for exam-
ple:
a /= 0;  /* divide by 0: was this what you were intending */
(757) constant conditional branch 
(Code Generator)
A conditional branch (generated by an if , for , while statement etc.) always follows 
the same path. This will be some sort of comparison involving a variable and a constant 
expression. For the code generator to issue this message, the variable must have local 
scope (either auto or static local) and the global optimizer must be enabled, possi-
bly at higher level than 1, and the warning level threshold may need to be lower than 
the default level of 0.
The global optimizer keeps track of the contents of local variables for as long as is pos-
sible during a function. For C code that compares these variables to constants, the 
result of the comparison can be deduced at compile time and the output code hard 
coded to avoid the comparison, for example:
{
  int a, b;
  a = 5;
  /* this can never be false;
     always perform the true statement */
  if(a == 4)
    b = 6;
will produce code that sets a to 5, then immediately sets b to 6. 
No code will be produced for the comparison if(a == 4). If a was a global variable, 
it may be that other functions (particularly interrupt functions) may modify it and so 
tracking the variable cannot be performed.
This warning may indicate more than an optimization made by the compiler. It may indi-
cate an expression with missing or badly placed parentheses, causing the evaluation 
to yield a value different to what you expected.
This warning may also be issued because you have written something like while(1). 
To produce an infinite loop, use for(;;).