aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-07-25 10:20:01 +0200
committerEugen Wissner <belka@caraus.de>2026-07-25 10:20:01 +0200
commit4f89a02e03b056d0c55108a8c9194126ef4ee811 (patch)
tree0d41c79a08afc69af2184ee77591ecc28eb592fa /gcc
parent1e0f89df48ba10cdde80bd623b84e20fb48b977d (diff)
downloadelna-4f89a02e03b056d0c55108a8c9194126ef4ee811.tar.gz
Fix repeat loop scoping
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gcc/elna-generic.cc4
-rw-r--r--gcc/testlib/elna-dg.exp15
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc
index f77f371..43739fb 100644
--- a/gcc/gcc/elna-generic.cc
+++ b/gcc/gcc/elna-generic.cc
@@ -1120,6 +1120,7 @@ namespace elna::gcc
void generic_visitor::visit(boot::repeat_statement *statement)
{
+ enter_scope();
tree loop_label = create_artificial_label(get_location(&statement->position()));
tree goto_loop = build1(GOTO_EXPR, void_type_node, loop_label);
append_statement(build1(LABEL_EXPR, void_type_node, loop_label));
@@ -1132,6 +1133,9 @@ namespace elna::gcc
tree condition_statement = build3(COND_EXPR, void_type_node,
this->current_expression, NULL_TREE, goto_loop);
append_statement(condition_statement);
+
+ tree repeat_binding = leave_scope();
+ append_statement(repeat_binding);
}
void generic_visitor::visit(boot::for_statement *statement)
diff --git a/gcc/testlib/elna-dg.exp b/gcc/testlib/elna-dg.exp
index 93c7762..03620e3 100644
--- a/gcc/testlib/elna-dg.exp
+++ b/gcc/testlib/elna-dg.exp
@@ -88,13 +88,25 @@ proc elna-convert-directive { line_var directive dg_name } {
# base - absolute path to the source directory, e.g. .../testsuite/elna.dg
# test - relative path from testsuite, e.g. fail_compilation/file_name.elna
#
+#
+# Creates a directory at $path, handling the case where a regular
+# file already exists at that location (leftover from a prior
+# interrupted run).
+#
+proc elna-ensure-dir { path } {
+ if { [file exists $path] && ![file isdirectory $path] } {
+ file delete $path
+ }
+ file mkdir $path
+}
+
proc elna-convert-test { base test { extra_lines "" } } {
set type [file dirname $test]
set target $test
# Opens a file in the build directory for writing and the source
# file for reading.
- file mkdir $type
+ elna-ensure-dir $type
set fin [open $base/$target r]
set fout [open $target w]
@@ -178,6 +190,7 @@ proc elna-handle-multimodule { base test } {
# Build extra directives: -I for imports and dg-additional-sources.
set extra_lines ""
lappend extra_lines "(* { dg-additional-options \"-I$dir\" } *)"
+ elna-ensure-dir $test
foreach src $extra_sources {
set src_rel [string range $src [expr {[string length $dir] + 1}] end]
file copy $src $test