bugKawa - Bugs: bug #40835, Return types cause class cast...

 
 

bug #40835: Return types cause class cast exceptions

Submitter:  Charles Turner <charlesturner>
Submitted:  Sat 07 Dec 2013 04:33:52 PM UTC
   
 
Category:  Code generation Severity:  3 - Normal
Item Group:  Run-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 09 Dec 2013 12:11:07 AM UTC, comment #1: 

The problem is that the parameter name 'list' clashed with the type specifier 'list'.  I renamed the parameter name to 'lst' where needed.

I didn't notice the failures, because I've mostly been using Java 8 pre-releases, and lib-test.scm has various failures because of Unicode charset changes.

Per Bothner <bothner>
Group administrator
Sat 07 Dec 2013 04:33:52 PM UTC, original submission:  

There are four testsuite failures in the SVN 7711 trunk which don't seem to have been noticed:

%%%% Starting test libs  (Writing full log to "libs.log")
./lib-test.scm:462: FAIL
./lib-test.scm:463: FAIL
./lib-test.scm:464: FAIL
./lib-test.scm:465: FAIL
...

The actual error is,
#|kawa:1|# (import (rnrs lists))
#|kawa:2|# (remp even? '(1 2 3 4 5))
java.lang.ClassCastException: cannot cast (1 2 3 4 5) to class-type
at gnu.kawa.lispexpr.LangObjType.coerceToClassType(LangObjType.java:362)
at kawa.lib.rnrs.lists.remp(lists.scm:243)

REMP, REMOVE, REMV, and REMQ are affected by this "return type" bug. Removing the return types from kawa/lib/rnrs/lists.scm "fixes" the problem. The two code generations are,

With return type
 0: aload_1
  1: invokestatic <Method gnu.kawa.lispexpr.LangObjType.coerceToClassType (java.lang.Object)gnu.bytecode.ClassType>
  4: aload_0
  5: invokestatic <Method kawa.lib.rnrs.lists.complement (gnu.mapping.Procedure)gnu.mapping.Procedure>
  8: aload_1
  9: invokestatic <Method kawa.lib.rnrs.lists.filter (gnu.mapping.Procedure,gnu.lists.LList)java.lang.Object>
 12: invokevirtual <Method gnu.bytecode.Type.coerceFromObject (java.lang.Object)java.lang.Object>
 15: areturn

Without return type
   0: aload_0
  1: invokestatic <Method kawa.lib.rnrs.lists.complement (gnu.mapping.Procedure)gnu.mapping.Procedure>
  4: aload_1
  5: invokestatic <Method kawa.lib.rnrs.lists.filter (gnu.mapping.Procedure,gnu.lists.LList)java.lang.Object>
  8: areturn

Charles Turner <charlesturner>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by charlesturner (Submitted the item)
  • -email is unavailable- added by charlesturner
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-12-09 bothner StatusNone Fixed
        Assigned toNone bothner
        Open/ClosedOpen Closed
    2013-12-07 charlesturner Carbon-Copy- Added charlesturner

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code