[Beignet] [PATCH] [PATCH]Fix compile errors for CLANG compiler
Lv Meng
meng.lv at intel.com
Tue Aug 5 19:31:15 PDT 2014
this patch would fix variable length array of non-POD element type error for CLANG compiler.
Signed-off-by: Lv Meng <meng.lv at intel.com>
---
backend/src/backend/gen_insn_selection.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index 090f897..39f5141 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -2799,7 +2799,7 @@ namespace gbe
/* XXX support scalar only right now. */
GBE_ASSERT(valueNum == 1);
GBE_ASSERT(bti.count == 1);
- GenRegister dst[valueNum];
+ GenRegister *dst = static_cast<GenRegister *>(alloca(sizeof(GenRegister) * valueNum));
GenRegister tmpAddr = getRelativeAddress(sel, addr, insn.getAddressSpace(), bti.bti[0]);
for ( uint32_t dstID = 0; dstID < valueNum; ++dstID)
dst[dstID] = sel.selReg(insn.getValue(dstID), ir::TYPE_U64);
@@ -2999,7 +2999,7 @@ namespace gbe
/* XXX support scalar only right now. */
GBE_ASSERT(valueNum == 1);
addr = GenRegister::retype(addr, GEN_TYPE_UD);
- GenRegister src[valueNum];
+ GenRegister *src = static_cast<GenRegister *>(alloca(sizeof(GenRegister) * valueNum));
for (uint32_t valueID = 0; valueID < valueNum; ++valueID)
src[valueID] = sel.selReg(insn.getValue(valueID), ir::TYPE_U64);
@@ -3710,11 +3710,10 @@ namespace gbe
{
using namespace ir;
GenRegister msgPayloads[4];
- GenRegister dst[insn.getDstNum()];
uint32_t srcNum = insn.getSrcNum();
uint32_t valueID = 0;
uint32_t msgLen = 0;
-
+ GenRegister *dst = static_cast<GenRegister *>(alloca(sizeof(GenRegister) * insn.getDstNum()));
for (valueID = 0; valueID < insn.getDstNum(); ++valueID)
dst[valueID] = sel.selReg(insn.getDst(valueID), insn.getDstType());
--
1.8.3.2
More information about the Beignet
mailing list