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.

(cherry picked from commit 313f376394)
This commit is contained in:
Martin Whitaker 2022-04-12 16:54:33 +01:00
parent f8e29ee5e1
commit 0ad16a6c0b
1 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2017 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
@ -421,9 +421,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);
}