[previous] 2883 [next] This 'goto' statement will always bypass the initialization of local variables.
Control flow

This goto statement will bypass the initialization of one or more local variables. Any attempt to use the value of one of these variables will result in undefined behaviour.


/*PRQA S 1313,2001,2015,2017,2200,2201,3201,3205,3220,3311,3408 ++*/
void foo(int n)
{
   goto LAB;                        /* 2883 */

   {
       int c = 0;

LAB:   ++n;                         /*      */
   }
}


MISRA-C:2004 Rules applicable to message 2883:

Rule  9.1  (Required) All automatic variables shall have been assigned a value before being used.


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