Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possible access violation in storage builder #1534

Merged
merged 4 commits into from
Jul 13, 2020
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
5 changes: 5 additions & 0 deletions include/gridtools/storage/builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ namespace gridtools {
void initializer_impl(
Fun const &fun, T *dst, Layout layout, info<N> const &info, std::index_sequence<Is...>) {
int length = info.length();
auto &&lengths = info.lengths();
#pragma omp parallel for
for (int i = 0; i < length; ++i) {
auto indices = info.indices(layout, i);
for (auto ok : {(indices[Is] < lengths[Is])...})
anstaf marked this conversation as resolved.
Show resolved Hide resolved
if (!ok)
goto skip;
dst[i] = fun(indices[Is]...);
skip:;
}
}

Expand Down