2019-08-22 19:29 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000245mercuryBugpublic2011-12-13 03:23
Reporterjfondren 
Assigned Tojuliensf 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000245: [Java, 11.07-beta-2011-12-06] crashes with ClassCastException
DescriptionA program as simple as,

main(!IO) :- io.write_string("Hello, world!\n", !IO).

which runs fine in --grade=asm_fast.gc , or with 11.01's Java,
crashes on start with 11.07-beta-2011-12-06's java grade.

Exception in thread "main" java.lang.ExceptionInInitializerError
    at jmercury.list.MR_init_scalars_0(list.java:328)
    at jmercury.list.<clinit>(list.java:337)
    at jmercury.io.<clinit>(io.java:947)
    at jmercury.hello.main_2_p_0(hello.java:88)
    at jmercury.hello.main(hello.java:50)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to jmercury.runtime.PseudoTypeInfo
    at jmercury.runtime.TypeInfo_Struct.init(TypeInfo_Struct.java:84)
    at jmercury.runtime.TypeInfo_Struct.<init>(TypeInfo_Struct.java:102)
    at jmercury.pretty_printer.MR_init_scalars_0(pretty_printer.java:695)
    at jmercury.pretty_printer.<clinit>(pretty_printer.java:781)
    ... 5 more
Additional InformationMercury Compiler, version 11.07-beta-2011-12-06, configured for i686-pc-linux-gnu

java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (fedora-60.1.10.4.fc16-i386)
OpenJDK Server VM (build 20.0-b11, mixed mode)

# failed identically with:
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) Server VM (build 21.1-b02, mixed mode)

# 11.07-beta-2011-12-06 was built with
configured by ./configure, generated by GNU Autoconf 2.61,
  with options \"'--disable-most-grades' '--enable-libgrades=java' '--with-default-grade=java'\"
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000434

juliensf (administrator)

We appear to be calling the old constructor for the TypeInfo_Struct class (i.e. the one with
the arity argument) from the initializer for some scalar common data.

~0000439

juliensf (administrator)

Last edited: 2011-12-12 05:09

I've updated a reduced test case. The problem occurs because we generate the following:

MR_scalar_common_1[1] = new jmercury.runtime.TypeInfo_Struct(jmercury.runtime.TypeInfo_Struct.maybe_new(builtin.builtin__type_ctor_info_func_0),
                3,
                jmercury.runtime.TypeInfo_Struct.maybe_new(univ.univ__type_ctor_info_univ_0),
                jmercury.runtime.TypeInfo_Struct.maybe_new(bug245.MR_scalar_common_1[0]),
                jmercury.runtime.TypeInfo_Struct.maybe_new(bug245.bug245__type_ctor_info_doc_0));

The TypeInfo_Struct no longer takes an arity argument. There seems to be an issue with how
rtti_to_mlds.m handles pseudo type-infos -- I've fixed that in my workspace and it makes no
difference to this. (For the Java backend, psuedo type-infos reuse the TypeInfo_Struct class.)

Does something other than rtti_to_mlds.m generate calls to the TypeInfo_Struct constructor?

~0000440

juliensf (administrator)

The answer to the above is yes, ml_unify_gen.m also generates them (when processing unifications
that involve type_info_cell_constructors). I will post a fix for this shortly.

~0000441

juliensf (administrator)

Fix committed.
+Notes

-Issue History
Date Modified Username Field Change
2011-12-07 22:19 jfondren New Issue
2011-12-07 22:36 juliensf Status new => confirmed
2011-12-07 23:11 juliensf Note Added: 0000434
2011-12-12 02:59 juliensf File Added: bug245.m
2011-12-12 03:03 juliensf Note Added: 0000439
2011-12-12 05:09 juliensf Note Edited: 0000439
2011-12-12 17:21 juliensf Note Added: 0000440
2011-12-12 17:29 juliensf Status confirmed => assigned
2011-12-12 17:29 juliensf Assigned To => juliensf
2011-12-13 03:23 juliensf Note Added: 0000441
2011-12-13 03:23 juliensf Status assigned => resolved
2011-12-13 03:23 juliensf Resolution open => fixed
+Issue History