[Beignet] [PATCH] [PATCH]Fix compile errors for CLANG compiler
Song, Ruiling
ruiling.song at intel.com
Thu Aug 7 00:30:29 PDT 2014
The patch LGTM.
Ruiling
-----Original Message-----
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Lv Meng
Sent: Wednesday, August 06, 2014 10:31 AM
To: beignet at lists.freedesktop.org
Cc: Lv, Meng
Subject: [Beignet] [PATCH] [PATCH]Fix compile errors for CLANG compiler
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
_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list