]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
a68: avoid finalizing free standing proc holes twice
authorJose E. Marchesi <jemarch@gnu.org>
Mon, 9 Feb 2026 22:19:07 +0000 (23:19 +0100)
committerJose E. Marchesi <jemarch@gnu.org>
Mon, 9 Feb 2026 22:19:07 +0000 (23:19 +0100)
Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

* a68-low-holes.cc (a68_wrap_formal_proc_hole): The wrapper is not
a top-level function.
* a68-low-units.cc (a68_lower_formal_hole): Reorder code and
remove spurious comment.

gcc/testsuite/ChangeLog

* algol68/compile/formal-hole-1.a68: New test.

gcc/algol68/a68-low-holes.cc
gcc/algol68/a68-low-units.cc
gcc/testsuite/algol68/compile/formal-hole-1.a68 [new file with mode: 0644]

index 2a6a02a90207226dc995582cd9252ea036b7ffbc..3eca4e4e0b2aea924abe14a781bd7e80b2c4a771 100644 (file)
@@ -164,7 +164,7 @@ a68_wrap_formal_proc_hole (NODE_T *p, tree wrapper)
     }
   DECL_ARGUMENTS (wrapper) = nreverse (DECL_ARGUMENTS (wrapper));
 
-  a68_push_function_range (wrapper, wrapper_ret_type, true /* top_level */);
+  a68_push_function_range (wrapper, wrapper_ret_type);
 
   /* We need a pointer to a function type.  */
   if (!POINTER_TYPE_P (TREE_TYPE (wrapped)))
index c5ae0d47328ed1587d7ef94164aef829727e69c0..23f4f22e7c164b669f7e13a6a3dd3f33a48a2ca4 100644 (file)
@@ -1296,13 +1296,12 @@ a68_lower_formal_hole (NODE_T *p, LOW_CTX_T ctx ATTRIBUTE_UNUSED)
        {
          decl = a68_make_anonymous_routine_decl (MOID (p));
          a68_add_decl (decl);
-         a68_wrap_formal_proc_hole (p, decl);
-
-         /* XXX necessary */
          a68_add_decl_expr (fold_build1_loc (a68_get_node_location (p),
                                              DECL_EXPR,
                                              TREE_TYPE (decl),
                                              decl));
+         a68_wrap_formal_proc_hole (p, decl);
+
          decl = fold_build1 (ADDR_EXPR,
                              build_pointer_type (TREE_TYPE (decl)),
                              decl);
diff --git a/gcc/testsuite/algol68/compile/formal-hole-1.a68 b/gcc/testsuite/algol68/compile/formal-hole-1.a68
new file mode 100644 (file)
index 0000000..95fe2bc
--- /dev/null
@@ -0,0 +1,7 @@
+{ Freestanding formal hole. }
+
+begin
+      proc msleep = (int ms) void:
+         proc(bits)int (nest C "usleep") (BIN ms);
+      skip
+end