+ Error ("Label '%s' is defined more than once", Name);
+ }
+
+ NewDOR = AddDefOrRef (Entry, Flags);
+
+ /* Walk through all occurrences of the label so far and evaluate
+ ** their relationship with the one passed to the function.
+ */
+ for (i = 0; i < CollCount (Entry->V.L.DefsOrRefs); i++) {
+ DOR = CollAt (Entry->V.L.DefsOrRefs, i);
+
+ if ((DOR->Flags & SC_DEF) && (Flags & SC_REF) && (Flags & SC_GOTO)) {
+ /* We're processing a goto and here is its destination label.
+ ** This means the difference between SP values is already known,
+ ** so we simply emit the SP adjustment code.
+ */
+ if (StackPtr != DOR->StackPtr) {
+ g_space (StackPtr - DOR->StackPtr);
+ }
+
+ /* Are we jumping into a block with initalization of an object that
+ ** has automatic storage duration? Let's emit a warning.
+ */
+ if ((long)CollLast (AIC) != DOR->LocalsBlockId &&
+ (CollCount (AIC) < DOR->Depth ||
+ (long)CollAt (AIC, DOR->Depth - 1) != DOR->LocalsBlockId)) {
+ Warning ("Goto at line %d to label %s jumps into a block with "
+ "initialization of an object that has automatic storage duration",
+ GetCurrentLine (), Name);
+ }
+ }
+
+
+ if ((DOR->Flags & SC_REF) && (DOR->Flags & SC_GOTO) && (Flags & SC_DEF)) {
+ /* We're processing a label, let's update all gotos encountered
+ ** so far
+ */
+ SymEntry *E;
+ g_userodata();
+ g_defdatalabel (DOR->LateSP_Label);
+ g_defdata (CF_CONST | CF_INT, StackPtr - DOR->StackPtr, 0);
+
+ /* Optimizer will need the information about the value of SP adjustment
+ ** later, so let's preserve it.
+ */
+ E = NewSymEntry (LocalLabelName (DOR->LateSP_Label), SC_SPADJUSTMENT);
+ E->V.SPAdjustment = StackPtr - DOR->StackPtr;
+ AddSymEntry (SPAdjustTab, E);
+
+ /* Are we jumping into a block with initalization of an object that
+ ** has automatic storage duration? Let's emit a warning.
+ */
+ if ((long)CollLast (AIC) != DOR->LocalsBlockId &&
+ (CollCount (AIC) >= DOR->Depth ||
+ (long)CollLast (AIC) >= (long)DOR->Line))
+ Warning ("Goto at line %d to label %s jumps into a block with "
+ "initialization of an object that has automatic storage duration",
+ DOR->Line, Name);
+ }
+