summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang, Rong R <rong.r.yang@intel.com>2017-07-27 13:46:11 +0800
committerYang Rong <rong.r.yang@intel.com>2017-07-27 16:19:41 +0800
commit83bac267481dc4b524ded5f139bb55cfd7cfbd04 (patch)
tree2d9f107d9757c716cce75fdf357b7ca08eb18071
parentad63a53e5f77eb2a09e0e72cbee60298d6ff4d02 (diff)
GBE: fix a errMsg uninitialized build warning.
Signed-off-by: Yang Rong <rong.r.yang@intel.com> Reviewed-by: Ruiling Song <ruiling.song@intel.com>
-rw-r--r--backend/src/backend/gen_program.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/src/backend/gen_program.cpp b/backend/src/backend/gen_program.cpp
index bb1d22fa..6ba2e549 100644
--- a/backend/src/backend/gen_program.cpp
+++ b/backend/src/backend/gen_program.cpp
@@ -504,7 +504,7 @@ namespace gbe {
{
#ifdef GBE_COMPILER_AVAILABLE
using namespace gbe;
- char* errMsg;
+ char* errMsg = NULL;
if(((GenProgram*)dst_program)->module == NULL){
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
((GenProgram*)dst_program)->module = llvm::CloneModule((llvm::Module*)((GenProgram*)src_program)->module).release();
@@ -512,7 +512,7 @@ namespace gbe {
((GenProgram*)dst_program)->module = llvm::CloneModule((llvm::Module*)((GenProgram*)src_program)->module);
#endif
errSize = 0;
- }else{
+ } else {
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 39
// Src now will be removed automatically. So clone it.
llvm::Module* src = llvm::CloneModule((llvm::Module*)((GenProgram*)src_program)->module).release();
@@ -528,7 +528,7 @@ namespace gbe {
#else
if (LLVMLinkModules(wrap(dst), wrap(src), LLVMLinkerPreserveSource, &errMsg)) {
#endif
- if (err != NULL && errSize != NULL && stringSize > 0u) {
+ if (err != NULL && errSize != NULL && stringSize > 0u && errMsg) {
strncpy(err, errMsg, stringSize-1);
err[stringSize-1] = '\0';
*errSize = strlen(err);