Rule 1.2 Problem wih array parameter

6.1 Environment

Moderators: misra-c, david ward

Posts: 2
Joined: Tue Mar 26, 2013 2:22 pm
Company: Lear

Rule 1.2 Problem wih array parameter

Postby pvarela » Tue Mar 26, 2013 3:17 pm

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 << 3U) + ((T_u16)CAN0RIDR1 >> 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

Posts: 547
Joined: Thu Jan 05, 2006 1:11 pm

Re: Rule 1.2 Problem wih array parameter

Postby misra-c » Thu Apr 04, 2013 10:41 am

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

Return to “6.1 Environment”

Who is online

Users browsing this forum: No registered users and 1 guest