Commit a5b8aacd by Eric Botcazou Committed by Eric Botcazou

decl.c (gnat_to_gnu_entity): Force constants initialized to a static constant to…

decl.c (gnat_to_gnu_entity): Force constants initialized to a static constant to be statically allocated...

	* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Force constants
	initialized to a static constant to be statically allocated even if
	they are of a padding type, provided the original type also has
	constant size.

From-SVN: r141883
parent 4364e851
2008-11-15 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Force constants
initialized to a static constant to be statically allocated even if
they are of a padding type, provided the original type also has
constant size.
2008-11-15 Laurent Guerby <laurent@guerby.net> 2008-11-15 Laurent Guerby <laurent@guerby.net>
PR ada/37993 PR ada/37993
...@@ -1281,12 +1281,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1281,12 +1281,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* If this is constant initialized to a static constant and the /* If this is constant initialized to a static constant and the
object has an aggregate type, force it to be statically object has an aggregate type, force it to be statically
allocated. */ allocated. This will avoid an initialization copy. */
if (const_flag && gnu_expr && TREE_CONSTANT (gnu_expr) if (!static_p && const_flag
&& gnu_expr && TREE_CONSTANT (gnu_expr)
&& AGGREGATE_TYPE_P (gnu_type)
&& host_integerp (TYPE_SIZE_UNIT (gnu_type), 1) && host_integerp (TYPE_SIZE_UNIT (gnu_type), 1)
&& (AGGREGATE_TYPE_P (gnu_type) && !(TREE_CODE (gnu_type) == RECORD_TYPE
&& !(TREE_CODE (gnu_type) == RECORD_TYPE && TYPE_IS_PADDING_P (gnu_type)
&& TYPE_IS_PADDING_P (gnu_type)))) && !host_integerp (TYPE_SIZE_UNIT
(TREE_TYPE (TYPE_FIELDS (gnu_type))), 1)))
static_p = true; static_p = true;
gnu_decl = create_var_decl (gnu_entity_id, gnu_ext_name, gnu_type, gnu_decl = create_var_decl (gnu_entity_id, gnu_ext_name, gnu_type,
......
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