[llvm-commits] CVS: llvm-java/include/llvm/Java/BytecodeParser.h

Alkis Evlogimenos alkis at cs.uiuc.edu
Tue May 25 16:55:01 PDT 2004


Changes in directory llvm-java/include/llvm/Java:

BytecodeParser.h updated: 1.2 -> 1.3

---
Log message:

Fix parsing problem in LOOKUPSWITCH. Evaluation order of function
arguments is not specified in C/C++. In this case gcc was evaluating
last to first so the case/offset pairs were reversed.


---
Diffs of the changes:  (+5 -4)

Index: llvm-java/include/llvm/Java/BytecodeParser.h
diff -u llvm-java/include/llvm/Java/BytecodeParser.h:1.2 llvm-java/include/llvm/Java/BytecodeParser.h:1.3
--- llvm-java/include/llvm/Java/BytecodeParser.h:1.2	Mon May 24 22:46:47 2004
+++ llvm-java/include/llvm/Java/BytecodeParser.h	Tue May 25 16:52:26 2004
@@ -508,12 +508,13 @@
                     switchCases_.clear();
                     skipPadBytes(i);
                     int def = readSInt(code, i);
-                    unsigned pairCount = readUInt(code, i);
+                    int pairCount = readSInt(code, i);
                     switchCases_.reserve(pairCount);
-                    while (pairCount--)
+                    while (pairCount--) {
+                        int value = readSInt(code, i);
                         switchCases_.push_back(
-                            std::make_pair(readSInt(code, i),
-                                           curBC + readSInt(code, i)));
+                            std::make_pair(value, curBC + readSInt(code, i)));
+                    }
                     THIS->do_switch(curBC, curBC + def, switchCases_);
                     break;
                 }





More information about the llvm-commits mailing list