MISRA Discussion Forums

Full Version: 5-0-4 false positive?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear MISRA team,

the following comparison of two values of the same type is marked as violation of 5-0-4:

Code:
typedef unsigned char ui8;

extern ui8 a;
extern ui8 b;

void test(void)
{
  if (a != b)// false positive?
  {
    a = b;
  }
}

Is this a false positive?
I fail to see implementation-defined behaviour.
BTW, the rule scope/text fails to reference the implementation-defined behaviour.
Thanks.
This is not one of our examples. If you are saying that your static analysis tool reports this as an error, you need to contact your tool vendor
The sign-ness of the underlying types haven't changed

You're right, we need a reference for the implementation defined behaviour