title: MISRA Violation Rule 10.1 and Enums
body: <p>First off, this is similar to: <a href="https://stackoverflow.com/questions/10582523/how-are-integer-types-converted-implicitly">How are integer types converted implicitly?</a> but with a different MISRA warning.</p>
  
  <p>The compiler does not generate a MISRA error, but the static analysis tool does.  I have a ticket with the tool manufacturer in progress.</p>
  
  <p>Given:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  enum Color {RED, VIOLET, BLUE, GREEN, YELLOW, ORANGE};
  
  int main(void)
  {
    enum Color my_color;
    my_color = BLUE;
    if (my_color == YELLOW)  // Generates MISRA violation, see below.
    {
       printf("Color is yellow.\n");
    }
    else
    {
       printf("Color is not yellow.\n");
    }
    return 0;
  }
  </code></pre>
  
  <p>The static analysis tool is generating a MISRA violation for the <code>if</code> statement:</p>
  
  <pre><code>MISRA-2004 Rule 10.1 violation: implicitly changing the signedness of an expression.
  Converting "4", with underlying type "char" (8 bits, signed),
  to type "unsigned int" (32 bits, unsigned) with different signedness.
  </code></pre>
  
  <p>Is the compiler correct (not identifying the defect) or the static analysis tool?</p>