harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Loenko (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-4378) [drlvm][verifier] VM does not reject class when aastore instruction uses the value which is not compatible with the component type of array
Date Wed, 18 Jul 2007 08:38:04 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mikhail Loenko closed HARMONY-4378.
-----------------------------------

    Resolution: Invalid

Harmony should not introduce stricter checks comparing to RI, otherwise we will break existing
apps. 
The test must be fixed or removed

> [drlvm][verifier]  VM does not reject class when  aastore instruction uses the value
which is not compatible with the component type of array
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4378
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4378
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Vera Petrashkova
>            Assignee: Mikhail Loenko
>            Priority: Minor
>         Attachments: aastoreTest.zip
>
>
> According to J2SE VM specifications VM must throw VerifyError when  assignment 
> conversions are not applied.
> But VM does not reject class when aastore instruction uses the value which is not compatible
with the component type of array.
> The incorrect situation can not be described on java because such source code is rejected
by compiler.
> It is similar the following case:
> --------------------
> public interface aastIntf { 
>     public abstract void intfMethod();
> }
> public class aastClIm implements aastIntf {
>     public void intfMethod() {
>         return;
>     }
>     public int test (String[] args) {
>         try {
>             aastCl cl = new aastCl();
>             cl.testField = new aaClIm();
>             cl.testNeg();
>             return 104;
>        } catch (VerifyError e) {
>            return 104;
>        } catch (ArrayStoreException e) {
>            return 104;
>        }
>    }
> }
> public class aastCl  {
>     public aastIntf testField [];
>     public void testNeg () {
>         aastClIm [][] marr = new aastClIm[1][1];
>          marr[0] = testField;                   <<<<<<<<<<<<<<<<<<
wrong assignment
>         return;
>     }
> }
> ------------------------
> The following synthetic test demonstrates this issue. Class files are in attachment.
> -------------aastIntf.jj------------------
> .interface public aastIntf
> .super java/lang/Object
> .method public abstract intfMethod()V
> .end method
> -------aastCl.jj----------
> .class public aastCl
> .super java/lang/Object
> .field public testField [LaastIntf;
> ; standard initializer
> .method public <init>()V
>    aload_0
>    invokespecial java/lang/Object/<init>()V
>    return
> .end method
> .method public testNeg()V
>    .limit stack 3
>    .limit locals 2
>    aload_0
>    getfield aastCl/testField [LaastIntf;
>    astore_1
> ; aastClIm [][] marr = new aastClIm[1][1]
> ; marr[0] = testField 
>    sipush 1
>    sipush 1
>    multianewarray [[LaastClIm; 2
>    sipush 0
>    aload_1
>    aastore
>   return
> .end method
> -------aastClIm.jj--------
> .class public aastClIm
> .super java/lang/Object
> .implements aastIntf
> ; standard initializer
> .method public <init>()V
>    aload_0
>    invokespecial java/lang/Object/<init>()V
>    return
> .end method
> ; test method
> .method public test([Ljava/lang/String;)I
>    .limit stack 3
>    .limit locals 3
> .catch java/lang/VerifyError from first to second using catcher
> .catch java/lang/ArrayStoreException from first to second using catcher1
> first:
>    new aastCl
>    dup
>    invokespecial aastCl/<init>()V
>    astore_2
>    aload_2
>    sipush 1
>    anewarray aastClIm
>    putfield aastCl/testField [LaastIntf;
>    aload_2
>    invokevirtual aastCl/testNeg()V
> second:
>    sipush 105
>    ireturn
> catcher:
>    sipush 104
>    ireturn
> catcher1:
>    sipush 104
>    ireturn
> .end method
> .method public intfMethod()V
>   .limit stack 2
>   .limit locals 1
>    return
> .end method
> --------test.java---------
> public class test {
>     public static void main(String[] args) {        
>         try {           
>             int t = new aastClIm().test(args);
>             System.out.println( t == 104 ? "Test passed" : "Test failed");
>             System.out.println("Returned value: "+t);
>         } catch (Throwable e){
>             System.out.println("Test failed. Unexpected error was thrown");
>             e.printStackTrace();
>         }
>     }
> }
> -------------
> Output on Harmony:
> ==========
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or
its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r551077, (Jun 27 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> Test failed
> Returned value: 105
> This test also fails on RI:
> ===========
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test failed
> Returned value: 105
> This issue causes the failure of VTS test
> vm/jvms/classFile/constraints/structural/constraint18/aastore03/aastore03.xml

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message