Rule 10.4 MISRA C 2012

PC-lint Plus User Discussion
Post Reply
Peter

Rule 10.4 MISRA C 2012

Post by Peter » Thu Mar 21, 2019 8:11 am

Hello,

using the PC Lint Version 9.00k with the MISRA C 2012 standard creates an error 9029 (Mismatched essential type categories for binary operator [MISRA 2012 Rule 10.4, required]) which I don’t understand.
Using the MISRA C 2004 standard does not point that error at this line.
Just the example where the error 9029 occurs. I now the union rule, but old code has to be reused which contains unions....

Code: Select all

typedef union
{
  uint8_t b[2];
  uint16_t w;
}TestUnion_tu;

typedef struct
{
  uint16_t value;
  TestUnion_tu TestUnion[5u];
}TestStruct_ts;

void foo(void)
{
	TestStruct_ts testStruct;
	
	/* Here the error 9029 occurs */
	test.TestUnion[1u].w = 5u;
}
Any idea?
Thanks for any help.
Peter

Maxwell

Re: Rule 10.4 MISRA C 2012

Post by Maxwell » Fri Mar 29, 2019 7:58 pm

Your example uses something called test in the last statement but nothing is defined with this name.

mmetivier

Re: Rule 10.4 MISRA C 2012

Post by mmetivier » Mon Apr 01, 2019 2:30 pm

Also, this doesn't appear to be an issue using PC-Lint Plus, which likely makes it a shortcoming of original PC-Lint's type system that was resolved when much of the underlying code was redone in the new utility.

Post Reply