From: Jose E. Marchesi Date: Mon, 9 Feb 2026 22:19:07 +0000 (+0100) Subject: a68: avoid finalizing free standing proc holes twice X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3b8fd200a4b301e0cb62497af0e2b157326375e;p=thirdparty%2Fgcc.git a68: avoid finalizing free standing proc holes twice Signed-off-by: Jose E. Marchesi 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 --git a/gcc/algol68/a68-low-holes.cc b/gcc/algol68/a68-low-holes.cc index 2a6a02a9020..3eca4e4e0b2 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 c5ae0d47328..23f4f22e7c1 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 00000000000..95fe2bc60c7 --- /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