https://gcc.gnu.org/g:d3b8fd200a4b301e0cb62497af0e2b157326375e
commit r16-7420-gd3b8fd200a4b301e0cb62497af0e2b157326375e Author: Jose E. Marchesi <[email protected]> Date: Mon Feb 9 23:19:07 2026 +0100 a68: avoid finalizing free standing proc holes twice Signed-off-by: Jose E. Marchesi <[email protected]> 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. Diff: --- gcc/algol68/a68-low-holes.cc | 2 +- gcc/algol68/a68-low-units.cc | 5 ++--- gcc/testsuite/algol68/compile/formal-hole-1.a68 | 7 +++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/algol68/a68-low-holes.cc b/gcc/algol68/a68-low-holes.cc index 2a6a02a90207..3eca4e4e0b2a 100644 --- a/gcc/algol68/a68-low-holes.cc +++ b/gcc/algol68/a68-low-holes.cc @@ -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))) diff --git a/gcc/algol68/a68-low-units.cc b/gcc/algol68/a68-low-units.cc index c5ae0d47328e..23f4f22e7c16 100644 --- a/gcc/algol68/a68-low-units.cc +++ b/gcc/algol68/a68-low-units.cc @@ -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 index 000000000000..95fe2bc60c77 --- /dev/null +++ b/gcc/testsuite/algol68/compile/formal-hole-1.a68 @@ -0,0 +1,7 @@ +{ Freestanding formal hole. } + +begin + proc msleep = (int ms) void: + proc(bits)int (nest C "usleep") (BIN ms); + skip +end
