[previous] 0401 [next] [U] '%s' may be modified more than once between sequence points - evaluation order unspecified.
Explicitly undefined REFERENCE - ISO:C90-6.3 Expressions

In this statement, it is possible that an object is being updated more than once between sequence points. If it is, the result will be undefined.

In C the order in which side effects are performed is not well defined. If an object is modified more than once between sequence points, the C language does not define in which order the 2 updates are performed. If an object is definitely modified more than once between , message 0400 is generated. Definite sources of modification occur in assignment operations and increment and decrement operations.

Possible sources of modification are associated with situations where the address of an object is passed to a function and the function parameter is not defined as a pointer to a "const qualified" type, In such situations, QAC is unable to determine whether the called function will actually modify the object or not; the function argument is simply identified as a possible source of modification. Message 0401 is generated when there exists more than one possible source of modification within the statement.

In the code examples shown below:


/*PRQA S 2017,3198,3199,3203,3227,3408,3440,3447,3602 ++*/

extern int psef(int *p);
extern int nsef(const int *p);
extern int x;

extern void foo(void)
{
    int r;

    r = x-- + x++;                                /* a) - Message 400 */

    r = psef(&x) + x++;                           /* b) - Message 401 */

    r = psef(&x) + nsef(&x);                      /* c)               */

    r = nsef(&x) + nsef(&x);                      /* d)               */
}


MISRA C:2012 Rules applicable to message 0401:

Rule-1.3  (Required) There shall be no occurrence of undefined or critical unspecified behaviour
Rule-13.2  (Required) The value of an expression and its persistent side-effects shall be the same under all permitted evaluation orders


See also:

QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents