[Beignet] [PATCH] Properly check return value from __cxa_demangle
Jan Beich
jbeich at freebsd.org
Fri Mar 17 12:07:49 UTC 2017
FreeBSD uses libcxxrt (not GCC) for __cxa_demangle which doesn't
modify status variable on success thus makes Beignet rely on
unitialized value. Instead, assume it'd return NULL on failure.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213732
---
backend/src/llvm/llvm_gen_backend.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend/src/llvm/llvm_gen_backend.hpp b/backend/src/llvm/llvm_gen_backend.hpp
index 1ab77c9d..fde5e705 100644
--- a/backend/src/llvm/llvm_gen_backend.hpp
+++ b/backend/src/llvm/llvm_gen_backend.hpp
@@ -84,7 +84,7 @@ namespace gbe
if (it == map.end()) {
int status;
char *realName = abi::__cxa_demangle(symbol.c_str(), NULL, NULL, &status);
- if (status == 0) {
+ if (realName) {
std::string realFnName(realName), stripName;
stripName = realFnName.substr(0, realFnName.find("("));
it = map.find(stripName);
More information about the Beignet
mailing list