Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 1.2 Problem wih array parameter
I'm using lint to check my code is MISRA Compliant. I have one funtion with buffer definition. This buffer (8 uint8) is passed by parameter to another function to manage it. I receive this message in "CAN_Get_DCDC_SUP_Status(aux_Can);"
"Note 934: Taking address of near auto variable 'aux_Can' (arg. no. 1) [MISRA 2004 Rule 1.2]"

I have following sippet code:

T_u16 CanId = (T_u16)0;
T_u8 aux_Can[8]={0U,0U,0U,0U,0U,0U,0U,0U};

CanId = ((T_u16)((T_u16)CAN0RIDR0 > 5U));

switch (CanId)
case ID_DCDC_SUP_Status:

aux_Can[0] = CAN0RDSR0;
aux_Can[1] = CAN0RDSR1;
aux_Can[2] = CAN0RDSR2;
aux_Can[3] = CAN0RDSR3;
aux_Can[4] = CAN0RDSR4;
aux_Can[5] = CAN0RDSR5;
aux_Can[6] = CAN0RDSR6;
aux_Can[7] = CAN0RDSR7;


The funciton is

void CAN_Get_DCDC_SUP_Status(T_u8 *aux_Can)
T_u16 temp=0;

/*Byte 0*/
SetU2_DCDC_SUP_HVBatt_OC(aux_Can[0] & 0x03);
SetB_DCDC_SUP_DRV1_Fault(aux_Can[0] & 0x1);

with prototype (in header file):

void CAN_Get_DCDC_SUP_Status(T_u8 *aux_Can);

Does anyone has explanation/solution?

Best Regards
The fact that your tool uses the word "near" in the diagnostic message suggests that it has identified a potential problem with the use of the pointer in a segmented or paged memory architecture.

Whether or not this is a real problem in your situation will depend on the processor, the compiler and the way in which you have configured them both.

You will need to refer to the relevant technical manuals and perhaps talk to your tool supplier to understand the issue in more depth.
Posted by and on behalf of the MISRA C Working Group

Forum Jump:

Users browsing this thread: 1 Guest(s)