Skip to content

Commit

Permalink
Fix behaviour of fork/join_none with only one statement (issue #672).
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
martinwhitaker committed Apr 12, 2022
1 parent f3c4967 commit 313f376
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions t-dll-proc.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2021 Stephen Williams ([email protected])
* Copyright (c) 2000-2022 Stephen Williams ([email protected])
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 313f376

Please sign in to comment.