Skip to content

Commit c4c456b

Browse files
[SYCL] fix for kernel_compiler (#13214)
problem discovered when using -fsanitize=address on the KernelCompiler tests
1 parent 9842ed1 commit c4c456b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sycl/source/detail/kernel_compiler/kernel_compiler_opencl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,11 @@ spirv_vec_t OpenCLC_to_SPIRV(const std::string &Source,
191191
assert(SpirV.size() == 0 && "More than one SPIR-V output found.");
192192
SpirV = spirv_vec_t(Outputs[i], Outputs[i] + OutputLengths[i]);
193193
} else if (!strcmp(OutputNames[i], "stdout.log")) {
194-
const char *LogText = reinterpret_cast<const char *>(Outputs[i]);
195-
if (LogText != nullptr && LogText[0] != '\0') {
196-
CompileLog.append(LogText);
194+
if (OutputLengths[i] > 0) {
195+
const char *LogText = reinterpret_cast<const char *>(Outputs[i]);
196+
CompileLog.append(LogText, OutputLengths[i]);
197197
if (LogPtr != nullptr)
198-
LogPtr->append(LogText);
198+
LogPtr->append(LogText, OutputLengths[i]);
199199
}
200200
}
201201
}

0 commit comments

Comments
 (0)