Bug 4439 - CNI: would be nice to be able to create Java array with 'new'
CNI: would be nice to be able to create Java array with 'new'
Status: NEW
Product: gcc
Classification: Unclassified
Component: java
3.0.1
: P3 enhancement
: ---
Assigned To: Not yet assigned to anyone
:
Depends on: 11006
Blocks:
  Show dependency treegraph
 
Reported: 2001-10-01 23:16 UTC by ashley
Modified: 2005-09-23 22:56 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-23 22:56:07


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ashley 2001-10-01 23:16:02 UTC
Try this:

    #include <gcj/javaprims.h>

    static void foo ()
        {
        new jboolean[1];
        }

Compile with this:

    gcc-3.0 gccbug.cpp

Results:

gccbug.cpp: In function `void foo()':
gccbug.cpp:5: Can't find class$
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
3.0.1-0pre0108

Environment:
$ uname -a
Linux server 2.2.19pre17 #1 Tue Mar 13 22:37:59 EST 2001 i686 unknown
Comment 1 ashley 2001-10-01 23:16:02 UTC
Fix:
no idea
Comment 2 Bryce McKinlay 2001-10-02 20:15:05 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Not a bug.
    
    Please re-read the CNI documentation at
    http://gcc.gnu.org/java/papers/cni/t1.html
    to see how to create a Java array from C++.
    
    However, it would be nice if CNI did support this syntax.
    Possibly we can implement it with operator overloading.
    
    Changing category to libgcj and filing as change-request.
Comment 3 Andrew Pinski 2003-05-28 00:23:18 UTC
It would be nice for this feature but it still segfaults which is clearly a bug, I will file it 
seperately.
Comment 4 ashley 2003-05-28 01:22:00 UTC
Please review the code. "new jboolean[1]" is _not_ attempting to create a new Java array, it should 
create a new C++ array (of one element, in this case) that happens to be of a Java primitive type, 
similar to "new short[1]". See C++ ARM sec. 5.3.3.

This is a bug relating to ordinary C++, not a suggestion for clever integration with Java.
Comment 5 Wolfgang Bangerth 2003-05-30 23:01:10 UTC
Andrew's report about the ICE is PR 11006 and thus covered elsewhere.
It has nothing to do with arrays, just with a bad interaction between
C++ and java builtin types.

In effect, this report is now only about the Java array stuff.

W.