Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MISRA 11.2
#1
Hi,

[ MISRA 11.2 ] Conversions shall not be performed between a pointer to object and any type, other than an integral type, another pointer to object type or a pointer to void.

I am using cystal revs for C MISRA C 2004 compliance.
Its showing violation in following code. pl. suggest solution for this.
cal_table F32 xdata cal_table[10];
here F32 is float.

Main.c
--------------
*( ( ( U8 * )&cal_table[ 0 ] ) + 0U ) = 0U;

if( ( command_str[ 2 ] == SNS_ID1 ) && ( command_str[ 3 ] == SNS_ID1 ) ) // SNS_ID1 is constant

*( ( ( U8 * )&cal_table[ i ] ) + ch ) = ASCII_Int( command_str + 10U, 3U );

ch = *( ( ( U8 * )&cal_table[ i ] ) + ch );

spi_write( ( U8 )AX5031_REG_PLLLOOP, ( U8 )AX5031_VAL_PLLLOOP ); //AX5031_REG_PLLLOOP & AX5031_VAL_PLLLOOP are constats.
<t></t>
Reply
#2
The code example does not appear to contain any violations of Rule 11.2 so you might want to discuss any such reported violations with your tool supplier.

The code does however violate advisory Rule 11.4 because an expression with type "pointer to float" is converted to "pointer to U8", for example in:
Code:
( U8 * )&cal_table[0]
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)