gcj/214: Compiler generates incorrect array initialization code

Alexandre Petit-Bianco apbianco@cygnus.com
Sat Apr 22 16:16:00 GMT 2000


The following reply was made to PR gcj/214; it has been noted by GNATS.

From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/214: Compiler generates incorrect array initialization code
Date: Sat, 22 Apr 2000 16:12:47 -0700 (PDT)

 jsturm@sigma6.com writes:
 > [jsturm@cc42593-a tmp]$ ./staticarray
 > 2
 > 3
 > 4
 > 0
 > 
 > (Expected output is 1,2,3,4)
 > >Fix:
 
 Jeff, please try the following patch:
 
 2000-04-05  Alexandre Petit-Bianco  <apbianco@cygnus.com>
 
 	* class.c (build_java_array_type): `data' to always use pointer
 	alignment.
 
 Index: typeck.c
 ===================================================================
 RCS file: /cvs/cvsfiles/devo/gcc/java/typeck.c,v
 retrieving revision 1.51
 diff -u -p -r1.51 typeck.c
 --- typeck.c    2000/03/13 19:42:33     1.51
 +++ typeck.c    2000/04/06 01:44:57
 @@ -417,6 +417,7 @@ build_java_array_type (element_type, len
      {
        tree atype = build_prim_array_type (element_type, length);
        tree arfld = build_decl (FIELD_DECL, get_identifier ("data"), atype);
 +      TYPE_ALIGN (atype) = TYPE_ALIGN (ptr_type_node);
        DECL_CONTEXT (arfld) = t;
        TREE_CHAIN (fld) = arfld;
 
 ./A


More information about the Java-prs mailing list