MISRA Discussion Forums
Rule 1.2 Problem wih array parameter - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA-C: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17)
+---- Forum: 6.1 Environment (https://forum.misra.org.uk/forumdisplay.php?fid=28)
+---- Thread: Rule 1.2 Problem wih array parameter (/showthread.php?tid=952)



Rule 1.2 Problem wih array parameter - pvarela - 26-03-2013

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;

CAN_Get_DCDC_SUP_Status(aux_Can);
(....)


The funciton is

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

/*Byte 0*/
aux_Can[0]=aux_Can[0]>>1;
SetU2_DCDC_SUP_HVBatt_OC(aux_Can[0] & 0x03);
aux_Can[0]=aux_Can[0]>>2;
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


Re: Rule 1.2 Problem wih array parameter - misra-c - 04-04-2013

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.