<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 14, 2013 at 9:58 AM, Jyotsna Verma <span dir="ltr"><<a href="mailto:jverma@codeaurora.org" target="_blank">jverma@codeaurora.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jverma<br>
Date: Thu Feb 14 11:58:13 2013<br>
New Revision: 175185<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=175185&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=175185&view=rev</a><br>
Log:<br>
Fix for bug 15246 -- out-of-bound error in the TableGen backend, CodeGenMapTable.cpp.<br>
<br>
Modified:<br>
    llvm/trunk/utils/TableGen/CodeGenMapTable.cpp<br></blockquote><div><br></div><div style>Test case?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Modified: llvm/trunk/utils/TableGen/CodeGenMapTable.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenMapTable.cpp?rev=175185&r1=175184&r2=175185&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenMapTable.cpp?rev=175185&r1=175184&r2=175185&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/utils/TableGen/CodeGenMapTable.cpp (original)<br>
+++ llvm/trunk/utils/TableGen/CodeGenMapTable.cpp Thu Feb 14 11:58:13 2013<br>
@@ -533,12 +533,11 @@ static void emitEnums(raw_ostream &OS, R<br>
        II = ColFieldValueMap.begin(), IE = ColFieldValueMap.end();<br>
        II != IE; II++) {<br>
     std::vector<Init*> FieldValues = (*II).second;<br>
-    unsigned FieldSize = FieldValues.size();<br>
<br>
     // Delete duplicate entries from ColFieldValueMap<br>
-    for (unsigned i = 0; i < FieldSize - 1; i++) {<br>
+    for (unsigned i = 0; i < FieldValues.size() - 1; i++) {<br>
       Init *CurVal = FieldValues[i];<br>
-      for (unsigned j = i+1; j < FieldSize; j++) {<br>
+      for (unsigned j = i+1; j < FieldValues.size(); j++) {<br>
         if (CurVal == FieldValues[j]) {<br>
           FieldValues.erase(FieldValues.begin()+j);<br>
         }<br>
@@ -547,9 +546,9 @@ static void emitEnums(raw_ostream &OS, R<br>
<br>
     // Emit enumerated values for the column fields.<br>
     OS << "enum " << (*II).first << " {\n";<br>
-    for (unsigned i = 0; i < FieldSize; i++) {<br>
+    for (unsigned i = 0, endFV = FieldValues.size(); i < endFV; i++) {<br>
       OS << "\t" << (*II).first << "_" << FieldValues[i]->getAsUnquotedString();<br>
-      if (i != FieldValues.size() - 1)<br>
+      if (i != endFV - 1)<br>
         OS << ",\n";<br>
       else<br>
         OS << "\n};\n\n";<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>