MISRA Discussion Forums
5-0-4 false positive? - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.5 Expressions (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=134)
+---- Thread: 5-0-4 false positive? (/showthread.php?tid=1362)



5-0-4 false positive? - dg1980 - 06-09-2017

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.


Re: 5-0-4 false positive? - misra cpp - 22-09-2017

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