@@ -151,42 +151,40 @@ void goto_convertt::finish_gotos(goto_programt &dest, const irep_idt &mode)
151151 targets.destructor_stack .get_nearest_common_ancestor_info (
152152 goto_target, label_target);
153153
154- bool not_prefix =
155- intersection_result.right_depth_below_common_ancestor != 0 ;
156-
157154 // If our goto had no variables of note, just skip
158155 if (goto_target != 0 )
159156 {
160157 // If the goto recorded a destructor stack, execute as much as is
161158 // appropriate for however many automatic variables leave scope.
162- // We don't currently handle variables *entering* scope, which
163- // is illegal for C++ non-pod types and impossible in Java in any case.
164- if (not_prefix)
165- {
166- debug ().source_location = i.source_location ();
167- debug () << " encountered goto '" << goto_label
168- << " ' that enters one or more lexical blocks; "
169- << " omitting constructors and destructors" << eom;
170- }
171- else
172- {
173- debug ().source_location = i.source_location ();
174- debug () << " adding goto-destructor code on jump to '" << goto_label
175- << " '" << eom;
176-
177- node_indext end_destruct = intersection_result.common_ancestor ;
178- goto_programt destructor_code;
179- unwind_destructor_stack (
180- i.source_location (),
181- destructor_code,
182- mode,
183- end_destruct,
184- goto_target);
185- dest.destructive_insert (g_it.first , destructor_code);
186-
187- // This should leave iterators intact, as long as
188- // goto_programt::instructionst is std::list.
189- }
159+ debug ().source_location = i.source_location ();
160+ debug () << " adding goto-destructor code on jump to '" << goto_label
161+ << " '" << eom;
162+
163+ node_indext end_destruct = intersection_result.common_ancestor ;
164+ goto_programt destructor_code;
165+ unwind_destructor_stack (
166+ i.source_location (),
167+ destructor_code,
168+ mode,
169+ end_destruct,
170+ goto_target);
171+ dest.destructive_insert (g_it.first , destructor_code);
172+
173+ // This should leave iterators intact, as long as
174+ // goto_programt::instructionst is std::list.
175+ }
176+
177+ // We don't currently handle variables *entering* scope, which
178+ // is illegal for C++ non-pod types and impossible in Java in any case.
179+ // This is however valid C.
180+ const bool variables_added_to_scope =
181+ intersection_result.right_depth_below_common_ancestor > 0 ;
182+ if (variables_added_to_scope)
183+ {
184+ debug ().source_location = i.source_location ();
185+ debug () << " encountered goto '" << goto_label
186+ << " ' that enters one or more lexical blocks; "
187+ << " omitting constructors." << eom;
190188 }
191189 }
192190 else
0 commit comments