Skip to content

Conversation

@EwanC
Copy link
Contributor

@EwanC EwanC commented Aug 25, 2023

Fix macOS CI fail in post-commit CI by asserting on false, then providing the error string.

Error

/Users/runner/work/llvm/llvm/src/sycl/source/detail/graph_impl.cpp:140:16: error: implicit conversion turns string literal into bool: 'const char[55]' to 'bool' [-Werror,-Wstring-conversion]
        assert("Node duplication failed. A duplicated node is missing.");
        ~~~~~~~^~~~~~~~~~~~~~~~~~~

Fix [macOS CI fail in post-commit CI] (https://github.com/intel/llvm/actions/runs/5975037762/job/16210261083)
by asserting on `false`, then providing the error string.

```
/Users/runner/work/llvm/llvm/src/sycl/source/detail/graph_impl.cpp:140:16: error: implicit conversion turns string literal into bool: 'const char[55]' to 'bool' [-Werror,-Wstring-conversion]
        assert("Node duplication failed. A duplicated node is missing.");
        ~~~~~~~^~~~~~~~~~~~~~~~~~~
```
@EwanC EwanC marked this pull request as ready for review August 25, 2023 13:49
@EwanC EwanC requested a review from a team as a code owner August 25, 2023 13:49
@reble reble changed the title [SYCL][Graphs] Correct assert usage [SYCL][Graph] Correct assert usage Aug 25, 2023
assert("Node duplication failed. A duplicated node is missing.");
assert(false &&
"Node duplication failed. A duplicated node is missing.");
}
Copy link
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
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
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
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants