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]

[Ada] Fix endless loop


Tested on i686-linux, committed on mainline.

The compiler was looping endlessly when processing an anonymous access-
to-subprogram type in the access definition of an object declaration,
due to a missing test when searching up parents for the associated Itype.
The customer's test case also exposed a problem with null exclusion checks
in Null_Exclusion_Static_Checks; such checks should not be performed for
an object declaration with an access definition (since the null exclusion
is being imposed on a new type). Additionally, it was noticed that the
Corresponding_Spec attribute was not being set on the empty body node
created for null procedures, fixed in Expand_N_Subprogram_Declaration, and
the call to Set_Body_To_Inline was changed to no longer call New_Copy_Tree.
The following test case must compile quietly with gcc -c -gnat05:
package Null_Proc is
    procedure Do_Nothing is null;
    X: constant not null access procedure := Do_Nothing'Access;
end Null_Proc;

Also fix another bug: if the designated type of an access type is an access
type, and this latter declaration references some entity from the limited view,
the frontend must not handle the associated non-limited view. For example,
in the following code, the access type-declaration at [1] references
one entity from the limited view; the access type-declaration at
[2] that references [1] is an example of the case covered by this
patch.

package N is
   type M is null record;
end N;

limited with N;
package P is
   type Q is access N.M; -- 1
end P;

package P.Child is
   type R is access Q;   -- 2
end P.Child;

2005-07-04  Gary Dismukes  <dismukes@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>
	    Javier Miranda  <miranda@adacore.com>

	* checks.adb (Null_Exclusion_Static_Checks): In the case of
	N_Object_Declaration, only perform the checks if the Object_Definition
	is not an Access_Definition.

        * sem_ch3.adb (Access_Subprogram_Declaration): Add test for the case
        where the parent of an the access definition is an N_Object_Declaration
        when determining the Associated_Node_For_Itype and scope of an
        anonymous access-to-subprogram type.

	* exp_ch6.adb (Expand_N_Subprogram_Declaration): Set the
	Corresponding_Spec on the body created for a null procedure. Add ???
	comment. Remove New_Copy_Tree call on body argument to
	Set_Body_To_Inline.

	* exp_ch6.adb (Add_Simple_Call_By_Copy_Code): For an out parameter with
	discriminants, use the type of the actual as well, because the
	discriminants may be read by the called subprogram.

	* sem_ch3.adb (Access_Type_Declaration): If the designated type is an
	access type we do not need to handle non-limited views.
	(Build_Derived_Record_Type): Additional check to check that in case of
	private types, interfaces are only allowed in private extensions.

Attachment: difs.5
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]