Index: vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp =================================================================== --- vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp (revision 592325) +++ vm/jitrino/src/codegenerator/ia32/Ia32APIMagics.cpp (working copy) @@ -397,15 +397,16 @@ counterIsZeroNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, res, thisLen, trgtLen)); // strings are different - Opnd* two = irm->newImmOpnd(counterType,2); - differentStringsNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, thisAddrReg, thisAddrReg, two)); - differentStringsNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, trgtAddrReg, trgtAddrReg, two)); + Opnd* minustwo = irm->newImmOpnd(counterType,-2); Type* charType = irm->getTypeManager().getCharType(); - Opnd* thisChar = irm->newMemOpnd(charType, thisAddrReg); - Opnd* trgtChar = irm->newMemOpnd(charType, trgtAddrReg); - Opnd* dst = irm->newOpnd(charType); - differentStringsNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, dst, thisChar, trgtChar)); - differentStringsNode->appendInst(irm->newInstEx(Mnemonic_MOVSX, 1, res, dst)); + Opnd* thisChar = irm->newMemOpnd(charType, thisAddrReg, NULL, NULL, minustwo); + Opnd* trgtChar = irm->newMemOpnd(charType, trgtAddrReg, NULL, NULL, minustwo); + Type* intType = res->getType(); + Opnd* thisInt = irm->newOpnd(intType); + Opnd* trgtInt = irm->newOpnd(intType); + differentStringsNode->appendInst(irm->newInstEx(Mnemonic_MOVZX, 1, thisInt, thisChar)); + differentStringsNode->appendInst(irm->newInstEx(Mnemonic_MOVZX, 1, trgtInt, trgtChar)); + differentStringsNode->appendInst(irm->newInstEx(Mnemonic_SUB, 1, res, thisInt, trgtInt)); callInst->unlink(); } Index: src/test/regression/H5067/Test.java =================================================================== --- src/test/regression/H5067/Test.java (revision 0) +++ src/test/regression/H5067/Test.java (revision 0) @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.harmony.drlvm.tests.regression.h5067; + +import junit.framework.TestCase; + +public class Test extends TestCase { + + public void test() { + char c_max = Character.MAX_VALUE; + String max = String.valueOf(Character.MAX_VALUE); + String s = String.valueOf("abcde"); + int res = max.compareTo(s); + + assertEquals(65438, res); + } + +} Index: src/test/regression/H5067/run.test.xml =================================================================== --- src/test/regression/H5067/run.test.xml (revision 0) +++ src/test/regression/H5067/run.test.xml (revision 0) @@ -0,0 +1,25 @@ + + + + + + + + +