Question about Dir 4.3 when a static function contains only variable declaration, asm and return statement

Moderators: misra-c, david ward

Post Reply
chenzhuowansui
Posts: 5
Joined: Wed Feb 20, 2019 5:59 am
Company: Synopsys

Question about Dir 4.3 when a static function contains only variable declaration, asm and return statement

Post by chenzhuowansui » Sat Jun 29, 2019 10:39 am

Hi,
Given the following case:

Code: Select all

static inline uint32_t test(void)
{
    uint32_t tmp;

    __asm__ __volatile__( 
        "mrc p15, 0, %0, c1, c0, 2\n\t"
        : "=r" (tmp)
        );

    return tmp;
}
i wonder if we could take the above case as compliant, as we cannot have variable declaration and return value in assembly. Thanks

chenzhuowansui
Posts: 5
Joined: Wed Feb 20, 2019 5:59 am
Company: Synopsys

Re: Question about Dir 4.3 when a static function contains only variable declaration, asm and return statement

Post by chenzhuowansui » Mon Aug 19, 2019 5:21 am

Could anyone help clarify it? thanks

chenzhuowansui
Posts: 5
Joined: Wed Feb 20, 2019 5:59 am
Company: Synopsys

Re: Question about Dir 4.3 when a static function contains only variable declaration, asm and return statement

Post by chenzhuowansui » Mon Aug 19, 2019 5:21 am

Not sure why this content was deledted and cannot be seen any longer, i just re-posted it here.
Could anyone help clarify it? thanks

static inline uint32_t test(void) {
uint32_t tmp;
__asm__ __volatile__( "mrc p15, 0, %0, c1, c0, 2\n\t" : "=r" (tmp) );
return tmp;
}


i wonder if we could take the above case as compliant, as we cannot have variable declaration and return value in assembly.

misra-c
Posts: 548
Joined: Thu Jan 05, 2006 1:11 pm

Re: Question about Dir 4.3 when a static function contains only variable declaration, asm and return statement

Post by misra-c » Fri Sep 06, 2019 2:30 pm

Thank you for your question. The MISRA-C Working Group will consider this question at their next meeting in October
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “7.4 Code design”