summaryrefslogtreecommitdiff
path: root/decuda_to_ptxplus
diff options
context:
space:
mode:
authorJimmy Kwa <[email protected]>2011-11-14 14:40:38 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:18:25 -0700
commit510c6c894a99adc19d41c6bc1a578a31d5da6b2c (patch)
tree9c5647dfbb96a8feab8f7982758ec096dd46d993 /decuda_to_ptxplus
parent359427fe2ca23cd5fa0998a8bd37cc4db2897124 (diff)
fixed memory error in decuda_to_ptxplus that was causing the type modifier for constants to not appear in some cases.
[git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 10931]
Diffstat (limited to 'decuda_to_ptxplus')
-rw-r--r--decuda_to_ptxplus/decuda.y4
-rw-r--r--decuda_to_ptxplus/decudaInstList.cc12
2 files changed, 8 insertions, 8 deletions
diff --git a/decuda_to_ptxplus/decuda.y b/decuda_to_ptxplus/decuda.y
index 9c8a5e7..0b297f8 100644
--- a/decuda_to_ptxplus/decuda.y
+++ b/decuda_to_ptxplus/decuda.y
@@ -313,10 +313,10 @@ constMemoryStatements : constMemoryStatement
constMemoryStatement : POUND constMemoryTypes constMemoryList { g_instList->setConstMemoryType($2); } NEWLINE
-constMemoryTypes : DDOTU32 { char tempString[5];
+constMemoryTypes : DDOTU32 { char* tempString = new char[5];
strcpy(tempString, ".u32");
$$ = tempString; }
- | DDOTF32 { char tempString[5];
+ | DDOTF32 { char* tempString = new char[5];
strcpy(tempString, ".f32");
$$ = tempString; }
;
diff --git a/decuda_to_ptxplus/decudaInstList.cc b/decuda_to_ptxplus/decudaInstList.cc
index 18955e1..3a77de3 100644
--- a/decuda_to_ptxplus/decudaInstList.cc
+++ b/decuda_to_ptxplus/decudaInstList.cc
@@ -343,7 +343,7 @@ void decudaInstList::addRegister(std::string reg, bool lo)
std::string parsedReg = parseRegister(reg, lo, vectorFlag);
// Add the register to instruction operand list
- char* regName = new char [strlen(parsedReg.c_str())];
+ char* regName = new char [strlen(parsedReg.c_str())+1];
strcpy(regName, parsedReg.c_str());
getListEnd().addOperand(regName);
}
@@ -388,7 +388,7 @@ void decudaInstList::addPredicate(std::string pred)
std::string parsedPred = parsePredicate(pred);
// Add the predicate to instruction operand list
- char* predName = new char [strlen(parsedPred.c_str())];
+ char* predName = new char [strlen(parsedPred.c_str())+1];
strcpy(predName, parsedPred.c_str());
getListEnd().addOperand(predName);
}
@@ -416,7 +416,7 @@ void decudaInstList::addDoublePredReg(std::string pred, std::string reg, bool lo
else
doublePredReg = parsedPred + "|" + parsedReg;
- char* doublePredRegName = new char [strlen(doublePredReg.c_str())];
+ char* doublePredRegName = new char [strlen(doublePredReg.c_str())+1];
strcpy(doublePredRegName, doublePredReg.c_str());
getListEnd().addOperand(doublePredRegName);
}
@@ -446,7 +446,7 @@ void decudaInstList::addTex(std::string tex)
}
// Add the tex to instruction operand list
- char* texName = new char [strlen(origTex.c_str())];
+ char* texName = new char [strlen(origTex.c_str())+1];
strcpy(texName, origTex.c_str());
getListEnd().addOperand(texName);
}
@@ -552,7 +552,7 @@ void decudaInstList::addVector(char* vector, int vectorSize) {
if(vectorSize == 1) {
std::string vectorNew = vector;
vectorNew = vectorNew.substr(0,vectorNew.size()-1) + ",_,_,_}";
- char* vectorNewName = new char [strlen(vectorNew.c_str())];
+ char* vectorNewName = new char [strlen(vectorNew.c_str())+1];
strcpy(vectorNewName, vectorNew.c_str());
getListEnd().addOperand(vectorNewName);
} else {
@@ -621,7 +621,7 @@ void decudaInstList::addMemoryOperand(std::string mem, int memType) {
}
// Add the memory operand to instruction operand list
- char* memName = new char [strlen(mem.c_str())];
+ char* memName = new char [strlen(mem.c_str())+1];
strcpy(memName, mem.c_str());
getListEnd().addOperand(memName);
}