[previous] 0944 [next] [C] The label '%s' is inside the scope of an identifier with variably modified type.
Constraint violations REFERENCE - ISO:C99-6.8.6.1 The goto statement - Constraints

This is a constraint error

This 'goto' statement jumps backwards and enters the scope of an identifier with variably modified type.

Jumping into into the scope of an identifier with variably modified type from outside the scope of that identifier is not permitted.

For example:


/*PRQA S 1051,2001,2015,2017,2200,2201,2212,3120,3220,3227,3408 ++*/

void foo(int n)
{
    if (n < 100)
    {
        int a[n];       /* "a" is declared with variably modified type */
        a[0] = 1;
lab1:   a[1] = 0;
        a[0] += n;
    }

    if (n == 0)
        goto lab1;      /* Message 0944 */
}


MISRA C:2012 Rules applicable to message 0944:

Rule-1.1  (Required) The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation's translation limits


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