diff --git a/projects/clr/rocclr/compiler/lib/utils/options.cpp b/projects/clr/rocclr/compiler/lib/utils/options.cpp index 0d1e309202..5ab7c7c64a 100644 --- a/projects/clr/rocclr/compiler/lib/utils/options.cpp +++ b/projects/clr/rocclr/compiler/lib/utils/options.cpp @@ -1489,10 +1489,14 @@ Options::getDumpFileName(const std::string& ext) } bool -Options::isCStrEqual(const char *cs1, const char* cs2) +Options::isCStrOptionsEqual(const char *cs1, const char* cs2) const { if ((cs1 != NULL) && (cs2 != NULL)) { return (strcmp(cs1, cs2) == 0); + } else if ((cs1 == NULL || strcmp(cs1,"") == 0) && + (cs2 == NULL || strcmp(cs2,"") == 0)) { + // consider empty string and NULL ptr (no string) as equal + return true; } return false; } @@ -1527,7 +1531,7 @@ bool Options::equals(const Options& other, bool ignoreClcOptions) const else if (OPTION_type(od) == OT_CSTRING) { OT_CSTRING_t* o = reinterpret_cast(addr); OT_CSTRING_t* o2 = reinterpret_cast(addr2); - if (*o != *o2) return false; + if (!isCStrOptionsEqual(*o,*o2)) return false; } else { return false; diff --git a/projects/clr/rocclr/compiler/lib/utils/options.hpp b/projects/clr/rocclr/compiler/lib/utils/options.hpp index 29d40b9483..6897762f58 100644 --- a/projects/clr/rocclr/compiler/lib/utils/options.hpp +++ b/projects/clr/rocclr/compiler/lib/utils/options.hpp @@ -263,7 +263,7 @@ public: std::string getDumpFileName(const std::string& ext); void setPerBuildInfo(const char* val, int encrypt, bool device); - bool isCStrEqual(const char *cs1, const char* cs2); + bool isCStrOptionsEqual(const char *cs1, const char* cs2) const; bool useDefaultWGS() { return UseDefaultWGS; } diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuprogram.cpp b/projects/clr/rocclr/runtime/device/gpu/gpuprogram.cpp index 09b3afb24c..a2991b3c5c 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpuprogram.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpuprogram.cpp @@ -1300,7 +1300,7 @@ NullProgram::parseAllILFuncs(const std::string& source) { bool doPatch = true; amd::option::Options *opts = getCompilerOptions(); - if (opts->isCStrEqual(opts->oVariables->XLang, "il")) { + if (opts->isCStrOptionsEqual(opts->oVariables->XLang, "il")) { doPatch = false; } // Find the patch position