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 comptation of size of array


Tested on i686-linux, committed on trunk

This change fixes an incorrect computation of the size of an array that
needs to be as big as the scope stack depth. The incorrect computation
caused index checks to fail in some cases when the compiler was built
with checks enabled.

These changes bring the implementation of Unchecked_Union in conformance
with the text of AI-216.

This patch introduces pragma Ada_2005 as a synonym for the
existing pragma Ada_05. The following program must compile quietly:

pragma Ada_2005;
procedure K is
   type R is not null access Integer;
begin
   null;
end;

This patch allows multiple arguments for the No_Return pragma. This will
be required in Ada 2005 (AI 329), and there is no reason not to backport
this upwards compatible enhancement to Ada 95 mode (since this is a GNAT
pragma in Ada 95).
A test case is:

procedure K is
   procedure A;
   procedure B;
   pragma No_Return (A, B);

   procedure A is begin B; end;
   procedure B is begin raise Constraint_Error; end;
begin
   null;
end;

this should compile quietly

Finally, Ada 2005 AI-419 specifies that limitedness is not inherited from a
limited interface, so that a type that implements a limited interface
and has limited components must be declared explicitly limited, using
new syntax. The corresponding legality check was missing.
The package p.ads, compiled with -gnat05, must yield:
--
gcc -c -gnat05 p.ads
p.ads:8:06: extension of nonlimited type cannot have limited components
p.ads:8:06: limitedness is not inherited from limited interface
p.ads:8:06: add explicit limited to type indication
--
package P is
   type Lim is limited interface;
   type Rec is private;
   type OK is limited private;
   task type Tsk;
private
  type Rec is new Lim with record
     T : Tsk;   --  Error
  end record;
--
  type Ok is limited new Lim with record
     T : Tsk;
  end record;
end;

2006-02-13  Thomas Quinot  <quinot@adacore.com>
	    Robert Dewar  <dewar@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>
	    Javier Miranda  <miranda@adacore.com>

	* sem_ch12.adb (Inline_Instance_Body): Remove erroneous assumption
	that Scope_Stack.First = 1.
	Properly handle Ada_Version_Explicit and Ada_Version_Config, which
	were not always properly handled previously.
	(Formal_Entity): Complete rewrite, to handle properly some complex case
	with multiple levels of parametrization by formal packages.
	(Analyze_Formal_Derived_Type): Propagate Ada 2005 "limited" indicator
	to the corresponding derived type declaration for proper semantics.

	* sem_prag.adb (Analyze_Pragma): Remove '!' in warning message.
	(Check_Component): Enforce restriction on components of
	unchecked_unions: a component in a variant cannot contain tasks or
	controlled types.
	(Unchecked_Union): Allow nested variants and multiple discriminants, to
	conform to AI-216.
	Add pragma Ada_2005 (synonym for Ada_05)
	Properly handle Ada_Version_Explicit and Ada_Version_Config, which
	were not always properly handled previously.
	Document that pragma Propagate_Exceptions has no effect
	(Analyze_Pragma, case Pure): Set new flag Has_Pragma_Pure
	(Set_Convention_From_Pragma): Check that if a convention is
	specified for a dispatching operation, then it must be
	consistent with the existing convention for the operation.
	(CPP_Class): Because of the C++ ABI compatibility, the programmer is no
	longer required to specify an vtable-ptr component in the record. For
	compatibility reasons we leave the support for the previous definition.
	(Analyze_Pragma, case No_Return): Allow multiple arguments

	* sem_ch3.ads, sem_ch3.adb (Check_Abstract_Overriding): Flag a
	non-overrideen inherited operation with a controlling result as
	illegal only its implicit declaration comes from the derived type
	declaration of its result's type.
	(Check_Possible_Deferred_Completion): Relocate the object definition
	node of the subtype indication of a deferred constant completion rather
	than directly analyzing it. The analysis of the generated subtype will
	correctly decorate the GNAT tree.
	(Record_Type_Declaration): Check whether this is a declaration for a
	limited derived record before analyzing components.
	(Analyze_Component_Declaration): Diagnose record types  not explicitly
	declared limited when a component has a limited type.
	(Build_Derived_Record_Type): Code reorganization to check if some of
	the inherited subprograms of a tagged type cover interface primitives.
	This check was missing in case of a full-type associated with a private
	type declaration.
	(Constant_Redeclaration): Check that the subtypes of the partial and the
	full view of a constrained deferred constant statically match.
	(Mentions_T): A reference to the current type in an anonymous access
	component declaration  must be an entity name.
	(Make_Incomplete_Type_Declaration): If type is tagged, set type of
	class_wide type to refer to full type, not to the incomplete one.
	(Add_Interface_Tag_Components): Do nothing if RE_Interface_Tag is not
	available. Required to give support to the certified run-time.
	(Analyze_Component_Declaration): In case of anonymous access components
	perform missing checks for AARM 3.9.2(9) and 3.10.2 (12.2).
	(Process_Discriminants): For an access discriminant, use the
	discriminant specification as the associated_node_for_itype, to
	simplify accessibility checks.

Attachment: difs.72
Description: Text document


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