diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-07-29 18:30:32 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-07-29 18:30:32 +0200 |
commit | ef5b0e6eb82accd461a538912af6631fcf9ad00d (patch) | |
tree | 4c209c324daddde0bd125c3b3c23b5250469acf3 /gcc/java | |
parent | eb9c434c0fa298c0fcb7172f5761970891dead8a (diff) | |
download | gcc-ef5b0e6eb82accd461a538912af6631fcf9ad00d.zip gcc-ef5b0e6eb82accd461a538912af6631fcf9ad00d.tar.gz gcc-ef5b0e6eb82accd461a538912af6631fcf9ad00d.tar.bz2 |
class.c (build_utf8_ref): Pad initializer string to utf8const_type's alignment.
* class.c (build_utf8_ref): Pad initializer string to utf8const_type's
alignment.
From-SVN: r138251
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/class.c | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 022cff0..9fad320 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2008-07-29 Jakub Jelinek <jakub@redhat.com> + + * class.c (build_utf8_ref): Pad initializer string to utf8const_type's + alignment. + 2008-07-29 Jan Hubicka <jh@suse.cz> * lang.c (java_post_options): Remove handling of flag_no_inline. diff --git a/gcc/java/class.c b/gcc/java/class.c index ef5cc0f..fecd962 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -930,8 +930,8 @@ static GTY(()) tree utf8_decl_list = NULL_TREE; tree build_utf8_ref (tree name) { - const char * name_ptr = IDENTIFIER_POINTER(name); - int name_len = IDENTIFIER_LENGTH(name); + const char * name_ptr = IDENTIFIER_POINTER (name); + int name_len = IDENTIFIER_LENGTH (name), name_pad; char buf[60]; tree ctype, field = NULL_TREE, str_type, cinit, string; static int utf8_count = 0; @@ -942,8 +942,11 @@ build_utf8_ref (tree name) return ref; ctype = make_node (RECORD_TYPE); + /* '\0' byte plus padding to utf8const_type's alignment. */ + name_pad = TYPE_ALIGN_UNIT (utf8const_type) + - (name_len & (TYPE_ALIGN_UNIT (utf8const_type) - 1)); str_type = build_prim_array_type (unsigned_byte_type_node, - name_len + 1); /* Allow for final '\0'. */ + name_len + name_pad); PUSH_FIELD (ctype, field, "hash", unsigned_short_type_node); PUSH_FIELD (ctype, field, "length", unsigned_short_type_node); PUSH_FIELD (ctype, field, "data", str_type); @@ -973,8 +976,7 @@ build_utf8_ref (tree name) { int decl_size; /* Ensure decl_size is a multiple of utf8const_type's alignment. */ - decl_size = (name_len + 5 + TYPE_ALIGN_UNIT (utf8const_type) - 1) - & ~(TYPE_ALIGN_UNIT (utf8const_type) - 1); + decl_size = name_len + 4 + name_pad; if (flag_merge_constants && decl_size < 256) { char buf[32]; |