]> git.sur5r.net Git - cc65/blobdiff - src/cc65/stmt.c
Proper warnings for "risky" gotos.
[cc65] / src / cc65 / stmt.c
index b766ec044e48e952a491208e483197fa300d57f5..0c891c386a5501f318f455547c263817557b0a91 100644 (file)
@@ -513,6 +513,7 @@ static int CompoundStatement (void)
 
     /* Remember the stack at block entry */
     int OldStack = StackPtr;
+    long OldBlockStackSize = CollCount (&CurrentFunc->LocalsBlockStack);
 
     /* Enter a new lexical level */
     EnterBlockLevel ();
@@ -535,7 +536,9 @@ static int CompoundStatement (void)
         g_space (StackPtr - OldStack);
     }
 
-    if (OldStack != StackPtr) {
+    /* If the segment had autoinited variables, let's pop it of a stack
+    of such blocks. */
+    if (OldBlockStackSize != CollCount (&CurrentFunc->LocalsBlockStack)) {
         CollPop (&CurrentFunc->LocalsBlockStack);
     }