[previous] 1313 [next] Executing 'goto %s' will cause local initialization to be skipped.
Miscellaneous REFERENCE - ISO:C90-6.1.2.4 Storage Durations of Objects

A goto statement is jumping into a block of code where a local object is initialized. This initialization will be bypassed with the result that the object may be used when unset.

Message 1313 will be generated either at the goto statement or at the labelled statement to which it jumps, whichever is located first.

For example:


/*PRQA S 1-9999 ++*/
/*PRQA S 1313, 2752, 2962, 3311, 3312 --*/

extern int f1(int i, int n)
{
    if (n > 0)
        goto IN;

    if (i)
    {
        int j = 2;

        IN: n = j + 2;                  /* Message 1313 + 3311 + 2962 */

        goto OUT;
    }

    OUT: i = 2 + n;

    return i;
}

extern int f2(int i, int n)
{
    if (i)
    {
        int j = 2;

        IN: n = j + 2;

        goto OUT;
    }

    OUT: i = 2 + n;

    if (n > 0)
        goto IN;                        /* Message 1313 + 3312 + 2752 */

    return i;
}


No MISRA C:2012 Rules applicable to message 1313


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