Skip to content

Commit

Permalink
Avoid illegal access for degenerated subslices of length 0
Browse files Browse the repository at this point in the history
  • Loading branch information
crtrott committed Jun 10, 2024
1 parent 5eb2aa5 commit 8244ef2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/test_submdspan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ struct TestSubMDSpan<
} else if constexpr (SubMDSpan::rank() == 0) {
return (&src_mds[SrcIdx...]==&sub_mds[]);
} else {
if(sub_mds.size() == 0) return true;
return (&src_mds[SrcIdx...]==&sub_mds[SubIdx...]);
}
#else
Expand All @@ -270,6 +271,7 @@ struct TestSubMDSpan<
} else if constexpr (SubMDSpan::rank() == 0) {
return (&src_mds(SrcIdx...)==&sub_mds());
} else {
if(sub_mds.size() == 0) return true;
return (&src_mds(SrcIdx...)==&sub_mds(SubIdx...));
}
#endif
Expand Down

0 comments on commit 8244ef2

Please sign in to comment.