Skip to content

Commit

Permalink
Fixes #378: Chop trailing '\0' from the compilation log.
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalroz committed Jul 22, 2022
1 parent ef46e32 commit 4966113
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cuda/nvrtc/compilation_output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,15 @@ class compilation_output_t {
*/
dynarray<char> log() const
{
size_t size;
auto status = nvrtcGetProgramLogSize(program_handle_, &size);
throw_if_error(status, "Failed obtaining compilation log size for "
size_t size_including_trailing_null;
auto status = nvrtcGetProgramLogSize(program_handle_, &size_including_trailing_null);
throw_if_error(status, "Failed obtaining compilation log size_including_trailing_null for "
+ compilation_output::detail_::identify(*this));
dynarray<char> result(size);
::std::vector<char> result(size_including_trailing_null);
status = nvrtcGetProgramLog(program_handle_, result.data());
throw_if_error(status, "Failed obtaining compilation log for"
+ compilation_output::detail_::identify(*this));
result.resize(size_including_trailing_null - 1);
return result;
}

Expand Down

0 comments on commit 4966113

Please sign in to comment.