Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sycl/source/detail/graph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ std::shared_ptr<node_impl> graph_impl::addSubgraphNodes(
auto Successor = NodesMap[NextNode];
NodeCopy->registerSuccessor(Successor, NodeCopy);
} else {
assert("Node duplication failed. A duplicated node is missing.");
assert(false &&
"Node duplication failed. A duplicated node is missing.");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to if statement in this case. Just move the condition to assert.

assert(NodesMap.find(NextNode) != NodesMap.end() && "Node duplication failed. A duplicated node is missing.");
auto Successor = NodesMap[NextNode];
NodeCopy->registerSuccessor(Successor, NodeCopy);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of this fix because it wasn't linked from the guilty PR, so I've created #10977 that does exactly what @bader asks for.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use at instead of operator [] to make out-of-bounds check by std::map and remove assert from the code? NOTE: this will enable the check in Release mode too, which might be not intended.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reble has pushed an update so that this PR uses at

}
}
Expand Down