+ /* The GNAT tree has the type of a function set to its result type, so we
+ adjust here. Also use the type of the result if the Etype is a subtype
+ that is nominally unconstrained. Likewise if this is a deferred constant
+ of a discriminated type whose full view can be elaborated statically, to
+ avoid problematic conversions to the nominal subtype. But remove any
+ padding from the resulting type. */
+ if (TREE_CODE (TREE_TYPE (gnu_result)) == FUNCTION_TYPE
+ || Is_Constr_Subt_For_UN_Aliased (gnat_temp_type)
+ || (Ekind (gnat_temp) == E_Constant
+ && Present (Full_View (gnat_temp))
+ && Has_Discriminants (gnat_temp_type)
+ && TREE_CODE (gnu_result) == CONSTRUCTOR))
+ {
+ gnu_result_type = TREE_TYPE (gnu_result);
+ if (TYPE_IS_PADDING_P (gnu_result_type))
+ gnu_result_type = TREE_TYPE (TYPE_FIELDS (gnu_result_type));
+ }
+