diff options
author | Andrew Haley <aph@redhat.com> | 2008-10-24 14:21:00 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2008-10-24 14:21:00 +0000 |
commit | 71c025f1dd4ae43442847281435d58c3530d0f69 (patch) | |
tree | b14fc306cdd4eb4397289755fa2de05759def7f7 /gcc/java | |
parent | 22f5c80bc589835aa10918be445cd0b9ae4be584 (diff) | |
download | gcc-71c025f1dd4ae43442847281435d58c3530d0f69.zip gcc-71c025f1dd4ae43442847281435d58c3530d0f69.tar.gz gcc-71c025f1dd4ae43442847281435d58c3530d0f69.tar.bz2 |
constants.c (build_constant_data_ref): Make sure we only build one copy of the decl for the constant pool.
2008-10-14 Andrew Haley <aph@redhat.com>
* constants.c (build_constant_data_ref): Make sure we only build
one copy of the decl for the constant pool.
From-SVN: r141344
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/constants.c | 30 |
2 files changed, 22 insertions, 13 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 4ef236e..5936783 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2008-10-14 Andrew Haley <aph@redhat.com> + + * constants.c (build_constant_data_ref): Make sure we only build + one copy of the decl for the constant pool. + 2008-08-27 Release Manager * GCC 4.3.2 released. diff --git a/gcc/java/constants.c b/gcc/java/constants.c index 8a3c532c..700dbb54 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -451,21 +451,25 @@ build_constant_data_ref (bool indirect) } else { - tree type, decl; tree decl_name = mangled_classname ("_CD_", output_class); + tree decl = IDENTIFIER_GLOBAL_VALUE (decl_name); - /* Build a type with unspecified bounds. The will make sure - that targets do the right thing with whatever size we end - up with at the end. Using bounds that are too small risks - assuming the data is in the small data section. */ - type = build_array_type (ptr_type_node, NULL_TREE); - - /* We need to lay out the type ourselves, since build_array_type - thinks the type is incomplete. */ - layout_type (type); - - decl = build_decl (VAR_DECL, decl_name, type); - TREE_STATIC (decl) = 1; + if (! decl) + { + /* Build a type with unspecified bounds. The will make sure + that targets do the right thing with whatever size we end + up with at the end. Using bounds that are too small risks + assuming the data is in the small data section. */ + tree type = build_array_type (ptr_type_node, NULL_TREE); + + /* We need to lay out the type ourselves, since build_array_type + thinks the type is incomplete. */ + layout_type (type); + + decl = build_decl (VAR_DECL, decl_name, type); + TREE_STATIC (decl) = 1; + IDENTIFIER_GLOBAL_VALUE (decl_name) = decl; + } return decl; } |