From 313f376394c4dc0aa21d3c0d3c63d4b1b6a9d992 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 12 Apr 2022 16:54:33 +0100 Subject: [PATCH] Fix behaviour of fork/join_none with only one statement (issue #672). The compiler normally optimises away the enclosing block statement if a block only contains one statement. But this is not valid for a fork/join_none block. --- t-dll-proc.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/t-dll-proc.cc b/t-dll-proc.cc index e0469284ce..27ec547857 100644 --- a/t-dll-proc.cc +++ b/t-dll-proc.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -426,9 +426,11 @@ bool dll_target::proc_block(const NetBlock*net) return true; } - /* If there is exactly one statement, there is no need for the - block wrapper, generate the contained statement instead. */ - if ((count == 1) && (net->subscope() == 0)) { + /* If there is exactly one statement and the block is not a + fork/join_none, there is no need for the block wrapper, + generate the contained statement instead. */ + if ((count == 1) && (net->subscope() == 0) && + (net->type() != NetBlock::PARA_JOIN_NONE)) { return net->proc_first()->emit_proc(this); }