Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 78314 invoked from network); 15 May 2007 12:22:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 May 2007 12:22:37 -0000 Received: (qmail 42570 invoked by uid 500); 15 May 2007 12:22:43 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 42548 invoked by uid 500); 15 May 2007 12:22:43 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 42539 invoked by uid 99); 15 May 2007 12:22:43 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 May 2007 05:22:43 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 May 2007 05:22:36 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4560871406A for ; Tue, 15 May 2007 05:22:16 -0700 (PDT) Message-ID: <4607411.1179231736281.JavaMail.jira@brutus> Date: Tue, 15 May 2007 05:22:16 -0700 (PDT) From: "Alexey Varlamov (JIRA)" To: commits@harmony.apache.org Subject: [jira] Closed: (HARMONY-1852) [drlvm][jit] irem and idiv return incorrect values when arguments are min value and -1 (Jitrino JET only) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-1852?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Alexey Varlamov closed HARMONY-1852. ------------------------------------ Resolution: Fixed Fixed at r538149, regtest added. > [drlvm][jit] irem and idiv return incorrect values when arguments are min value and -1 (Jitrino JET only) > ---------------------------------------------------------------------------------------------------------- > > Key: HARMONY-1852 > URL: https://issues.apache.org/jira/browse/HARMONY-1852 > Project: Harmony > Issue Type: Bug > Components: DRLVM > Environment: Linux IA-32, Windows IA-32 > Reporter: Irina Arkhipets > Assigned To: Alexey Varlamov > Attachments: H1852.diff, test_idiv.java, test_irem.java > > > J2SE VM Specification reads about irem and idev instructions: > ... > irem: This identity holds even in the special case in which the dividend is the negative int of largest possible magnitude for its type and the divisor is -1 (the remainder is 0). > idiv: There is one special case that does not satisfy this rule: if the dividend is the negative integer of largest possible magnitude for the int type, and the divisor is -1, then overflow occurs, and the result is equal to the dividend. Despite the overflow, no exception is thrown in this case. > ... > However, idiv and irem instructions return incorrect values when arguments are Integer.MIN_VALUE and -1 in some cases. > This bug is reproducible with Jitrino JET only. I am not able to reproduce it with Jitrino OPT and interpreter. > Please, compile the following soutsec and run them with "-Xem:jet" switch to reproduce this bug: > --------- test_irem.java ---------- > public class test_irem { > public static void main(String [] args) { > int i_min = Integer.MIN_VALUE; > int i_1 = -1; > int res = i_min % i_1; > if (res == 0) { > System.out.println("PASSED"); > } else { > System.out.println("FAILED: " + res); > } > } > } > --------- test_idiv.java --------- > public class test_idiv { > public static void main(String [] args) { > int i_min = Integer.MIN_VALUE; > int i_1 = -1; > int res = i_min / i_1; > if (res == Integer.MIN_VALUE) { > System.out.println("PASSED"); > } else { > System.out.println("FAILED: " + res); > } > } > } > ------------------------------------- > Sample output is: > ... > F:\...home\users\iarkhipe>java -Dvm.assert_dialog=false -Xem:jet test_irem > FAILED: 1 > F:\...home\users\iarkhipe>java -Dvm.assert_dialog=false -Xem:jet test_idiv > FAILED: 21247424 > ... > Please, note thet the following test examples works fine and always passes with Jitrino JET: > --------- test_irem.java ---------- > public class test_irem { > public static void main(String [] args) { > int res = Integer.MIN_VALUE % -1; > if (res == 0) { > System.out.println("PASSED"); > } else { > System.out.println("FAILED: " + res); > } > } > } > --------- test_idiv.java --------- > public class test_idiv { > public static void main(String [] args) { > int res = Integer.MIN_VALUE / -1; > if (res == Integer.MIN_VALUE) { > System.out.println("PASSED"); > } else { > System.out.println("FAILED: " + res); > } > } > } > ------------------------------------- -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.