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 bug in computation of 'Width


Tested on i686-linux, committed on trunk

This fixes a long-standing bug in the computation of the Width attribute.
For 96-bit floating-point types, the maximum exponent in decimal form is
one digit longer than for 64-bit (Long_Float) types. This error led to
an array overflow in the computation of the image of floating-point values
greater or equal to 1.0E1000.
The following must compile and execute quietly on a system where the
run-time is compiled with assertions enabled.
--
with Text_IO; use Text_IO;
procedure Img is
begin
   declare
      LLI : String := Long_Long_Float'image (Long_Long_Float'Last);
   begin
      null;
   end;
exception
   when others => Put_Line ("FAILED");
end;

In a component definition, the current instance of the enclosing type
can only be used with an attribute that yields an access type.
Compilation of main.adb must produce in a single line;
--
main.adb:5:33: In a constraint the current instance can only be used
   with an access attribute
--
procedure Main is
   type Bar(E : Integer) is null record;
   type CurrentType(D : Integer) is
      record
         Field : Bar(CurrentType'Size);
      end record;
begin
   null;
end Main;

2006-02-13  Javier Miranda  <miranda@adacore.com>
	    Ed Schonberg  <schonberg@adacore.com>

	* sem_attr.adb (Analyze_Attribute): In case of 'Class applied to an
	abstract interface type call analyze_and_resolve to expand the type
	conversion into the corresponding displacement of the
	reference to the base of the object.
	(Eval_Attribute, case Width): For systems where IEEE extended precision
	is supported, the maximum exponent occupies 4 decimal digits.
	(Accessibility_Message): Add '\' in 2-line warning message.
	(Resolve_Attribute): Likewise.
	(case Attribute_Access): Significantly revise checks
	for illegal access-to-subprogram Access attributes to properly enforce
	the rules of 3.10.2(32/2).
	Diagnose use of current instance with an illegal attribute.

        * sem_util.ads, sem_util.adb (Enclosing_Generic_Body): Change formal
        to a Node_Id.
        (Enclosing_Generic_Unit): New function to return a node's innermost
        enclosing generic declaration node.
        (Compile_Time_Constraint_Error): Remove '!' in warning messages.
        (Type_Access_Level): The accessibility level of anonymous acccess types
        associated with discriminants is that of the current instance of the
        type, and that's deeper than the type itself (AARM 3.10.2 (12.3.21)).
        (Compile_Time_Constraint_Error): Handle case of conditional expression.
        (Kill_Current_Values_For_Entity): New function
        (Enter_Name): Change formal type to Entity_Id

Attachment: difs.70
Description: Text document


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