5. If this is a reference to an unconstrained array which is used either
as the prefix of an attribute reference that requires an lvalue or in
- a return statement, then return the result unmodified because we want
- to return the original bounds.
+ a return statement without storage pool, return the result unmodified
+ because we want to return the original bounds.
6. Finally, if the type of the result is already correct. */
&& Present (Parent (gnat_node))
&& ((Nkind (Parent (gnat_node)) == N_Attribute_Reference
&& lvalue_required_for_attribute_p (Parent (gnat_node)))
- || Nkind (Parent (gnat_node)) == N_Simple_Return_Statement))
+ || (Nkind (Parent (gnat_node)) == N_Simple_Return_Statement
+ && No (Storage_Pool (gnat_node)))))
;
else if (TREE_TYPE (gnu_result) != gnu_result_type)