Abraxas/Misra Home  Table of Contents

Module - m67.html

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.

Misra-C Test Suite for Module - m67.c

/* Misra C Enforcement Testing */

Misra C Enforcement Testing */

/* Rule 67: Advisory */

Rule 67: Advisory */

/* Numeric variables being used within a for loop for iteration */

Numeric variables being used within a for loop for iteration */

/* counting should not be modified in the body of the loop. */

counting should not be modified in the body of the loop. */

/* This is in general difficult to detect automatically and statically. */

This is in general difficult to detect automatically and statically. */

/* The following gives a simple case. */

The following gives a simple case. */
#include "misra.h"
static void func67 ( SI_32 ) ;
static void
func67 ( SI_32 x ) 



Function Name: func67()

{
    
    x = 3;
    
}
SI_32
rule67 ( void ) 



Function Name: rule67()

{
    
SI_32 c = 3;
    
SI_32 i = 3;
SI_32 *pi = &i;
    
    for ( i = 0; i < 10; ++i ) 
    {
        
        i = 5; /*  RULE 67  */
        
    }
    
    for ( i = 0; i < 10; ++i ) 
    {
        
        ( *pi ) = 5; /*  RULE 67  */
        
    }
    
    for ( i = 0; i < 10; ++i ) 
    {
        
        func67 ( i ) ; 

/* Arg passed by value */

Arg passed by value */
        
    }
    
    return c;
    
}

Abraxas/Misra Home  Table of Contents

ABRAXAS SOFTWARE - CodeCheck MISRA Test-Suite Misra-C:1998 Misra-C:2004.