Bug 4439

Summary: CNI: would be nice to be able to create Java array with 'new'
Product: gcc Reporter: ashley
Component: javaAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED WONTFIX    
Severity: enhancement CC: bryce, gcc-bugs, java-prs
Priority: P3    
Version: 3.0.1   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2005-09-23 22:56:07
Bug Depends on: 11006    
Bug Blocks:    

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.
Comment 6 Andrew Pinski 2016-09-30 22:50:57 UTC
Closing as won't fix as the Java front-end has been removed from the trunk.