[ nice-Bugs-1113263 ] java.lang.VerifyError

"SourceForge.net" <[email protected]> Fri, 11 Feb 2005 23:40:35 -0800
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #1113263, was opened at 2005-01-31 19:22
Message generated for change (Settings changed) made by artemgr
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1113263&group_id=12788

Category: None
Group: None
Status: Open
Resolution: None
>Priority: 2
Submitted By: Artem Gr Kozarezov (artemgr)
Assigned to: Nobody/Anonymous (nobody)
Summary: java.lang.VerifyError

Initial Comment:
See attached files for details.
"nice-bug.src.zip" have test case sources.
"nice-bug.bin.zip" have both sources and compiled classes.


----------------------------------------------------------------------

Comment By: Artem Gr Kozarezov (artemgr)
Date: 2005-02-07 18:08

Message:
Logged In: YES 
user_id=289741

A shorter test case:

class AssertCaseFail {
  void?->void _aFirstPointer = null;
  void?->void _aSecondPointer = null;
  void aMethod(){
    let void->void fun;
    let first = _aFirstPointer; let second = _aSecondPointer;
    if( null != first ) fun = first;
    else if( null != second ) fun = second;
    else assert false;
    fun();
  }
}

void main( String[] ) = ( new AssertCaseFail() ).aMethod();

When compiled with nicec "build 2005.02.07" (assertions are
NOT enabled):
Exception in thread "main" nice.lang.AssertionFailed
        at letfun.c.fun.aMethod(c.nice:11)
        at letfun.c.AssertCaseFail.aMethod(c.nice)
        at letfun.c.fun.main(c.nice:16)
        at letfun.c.dispatch.main(dispatch.nice)

When compiled with nicec "build 2004.09.22":
Exception in thread "main" java.lang.VerifyError: (class:
letfun/c/fun, method: aMethod signature:
(Lletfun/c/AssertCaseFail;
)V) Register 1 contains wrong type
        at letfun.c.dispatch.main(dispatch.nice)

Expected behaviour is to give a compile-time error about
"fun" being used without being initialized. But the Nice
compiler currently thinks that "assert false" will always
exit from the method, which is wrong when assertions are not
enabled.

----------------------------------------------------------------------

Comment By: Arjan Boeijink (arjanb)
Date: 2005-02-02 02:09

Message:
Logged In: YES 
user_id=688815

The problem is the code generation of 'assert false' where the 
bytecode verifier can't always know code after that is 
unreachable.

I commited a workaround for the codegeneration.

Code being unreachable after 'assert false' is different 
behaviour than Java and might be unexpected when 
assertions disabled.
http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html

Daniel, what's your opinion on this?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=1113263&group_id=12788


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click