[Beignet] [PATCH] Avoid possible invalid pointer by vector interator.
yan.wang at linux.intel.com
yan.wang at linux.intel.com
Wed Dec 28 08:27:38 UTC 2016
From: Yan Wang <yan.wang at linux.intel.com>
"revisit" as vector containber will be pushed more elements in
findPointerEsacape() and cause previous interator to introduce
possible invalid pointer.
When compiling huge kernel like blender, it will cause random
segment fault crash.
[] operator will be more safe.
Signed-off-by: Yan Wang <yan.wang at linux.intel.com>
---
backend/src/llvm/llvm_gen_backend.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 8c7a230..e3543ae 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -1437,8 +1437,8 @@ namespace gbe
}
}
// storing/loading pointer would introduce revisit
- for (std::vector<Value *>::iterator iter = revisit.begin(); iter != revisit.end(); ++iter) {
- findPointerEscape(*iter, mixedPtr, true, revisit);
+ for (size_t i = 0; i < revisit.size(); ++i) {
+ findPointerEscape(revisit[i], mixedPtr, true, revisit);
}
// the second pass starts from mixed pointer
--
2.7.4
More information about the Beignet
mailing list