Commit 307233c2 by Andrew Haley Committed by Andrew Haley

constants.c (build_constant_data_ref): Make sure we only build one copy of the…

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: r141133
parent f6e6e990
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-09-22 Andrew Haley <aph@redhat.com> 2008-09-22 Andrew Haley <aph@redhat.com>
* expr.c (rules): Add new rule for * expr.c (rules): Add new rule for
......
...@@ -448,21 +448,25 @@ build_constant_data_ref (bool indirect) ...@@ -448,21 +448,25 @@ build_constant_data_ref (bool indirect)
} }
else else
{ {
tree type, decl;
tree decl_name = mangled_classname ("_CD_", output_class); 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 if (! decl)
that targets do the right thing with whatever size we end {
up with at the end. Using bounds that are too small risks /* Build a type with unspecified bounds. The will make sure
assuming the data is in the small data section. */ that targets do the right thing with whatever size we end
type = build_array_type (ptr_type_node, NULL_TREE); up with at the end. Using bounds that are too small risks
assuming the data is in the small data section. */
/* We need to lay out the type ourselves, since build_array_type tree type = build_array_type (ptr_type_node, NULL_TREE);
thinks the type is incomplete. */
layout_type (type); /* We need to lay out the type ourselves, since build_array_type
thinks the type is incomplete. */
decl = build_decl (VAR_DECL, decl_name, type); layout_type (type);
TREE_STATIC (decl) = 1;
decl = build_decl (VAR_DECL, decl_name, type);
TREE_STATIC (decl) = 1;
IDENTIFIER_GLOBAL_VALUE (decl_name) = decl;
}
return decl; return decl;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment