[previous] 0403 [next] [U] '%s' may be modified and accessed between sequence points - evaluation order unspecified.
Explicitly undefined REFERENCE - ISO:C90-6.3 Expressions

It is possible that an object is being both modified and accessed between sequence points. The ISO:C Standard says that if an object is modified and accessed other than to determine the new value between sequence points, the result will be undefined.

If the value of an object is being used and the value is also being modified within a statement, it is important to know whether the modification will occur before or after its value is used. Unfortunately this is not always defined.

Message 0403 is generated when the ordering of an access to an object and a possible modification of the object are undefined. Possible sources of modification are associated with situations where the address of the 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.

In the code examples shown below:


/*PRQA S 2017,3120,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 * 2);                            /* a) - Message 402 */

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

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


MISRA C:2012 Rules applicable to message 0403:

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


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