This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Tested on i686-linux, committed on trunk Fix handling of extended return, and in particular: The compiler blows up when processing a return from a primitive overriding function with a limited result type in the case where the function does not have a separate declaration. The needed implicit BIP_Alloc_Form formal was not created for such a function because the test for Has_Controlling_Formal in Create_Extra_Formals was returning false (due to not being set yet since New_Overloaded_Subprogram is called too late in the case of a body with no separate declaration). This is fixed by treating all functions with limited tagged results as equivalent to the unconstrained result subtype case, rather than restricting this treatment to functions with controlling results. The additional overhead is minor and most functions with tagged results are primitive in any case, plus this is necessary for proper treatment of calls through an access-to-subprogram value since such calls may be directed to both primitive and nonprimitive subprograms. A fix was also made to rewrite the target of the initialization assignment sometimes created for the first branch of the if statement generated for the BIP_Alloc_Form case, which needed to be assigning to a dereference of the BIP_Object_Access formal rather than the result object renaming (the problem being that the renaming declaration appears later than the assignment, resulting in a premature reference). gnat.dg/bip_prim_func.adb must compile quietly. 2007-06-06 Ed Schonberg <schonberg@adacore.com> Gary Dismukes <dismukes@adacore.com> Javier Miranda <miranda@adacore.com> * exp_ch5.adb (Expand_N_Assignment_Statement): For the assignment of a controlled type, use Make_Handler_For_Ctrl_Operation to construct the required exception handler. (Expand_Simple_Function_Return, Expand_N_Return_Statement): Handle properly the case of a function whose return type is a limited class-wide interface type. Modify the code of the accessibility check to handle class-wide interface objects. In this case we need to displace "this" to reference the primary dispatch table to get access to the TSD of the object (to evaluate its accessibility level). (Expand_N_Extended_Return_Statement): Test for a tagged result type rather than a controlling result as one of the conditions for generating tests of the implicit BIP_Alloc_Form formal. The initialization assignment is also handled according to whether the result is tagged instead of controlling. In the case where the init assignment is inserted in the "then" part of the allocation conditional, rewrite the target to be a dereference of the implicit BIP_Object_Access formal. If the returned value is unconstrained and created on the secondary stack, mark the enclosing block and function so that the secondary stack is not reclaimed on return. Treat returns from functions with controlling results similarly to returns from functions with unconstrained result subtypes. If the object returned is unconstrained, and an allocator must be created for it, analyze the allocator once the block for the extended return is installed, to ensure that finalizable components of the expression use the proper finalization list. Guard the call to Move_Final_List with a check that there is something to finalize. (Make_Tag_Ctrl_Assignment): Use "old" handling of controlled type assignment for virtual machines, since new code uses unsupported features (such as direct access to bytes in memory).
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |