===================================================================
@@ -25,6 +25,7 @@
with Aspects;
with Atree;
+with Debug;
with Elists;
with Fname;
with Lib;
@@ -51,7 +52,13 @@ begin
if Opt.Tree_Output then
Osint.C.Tree_Create;
Opt.Tree_Write;
- Aspects.Tree_Write;
+
+ -- For now, only write aspect specifications hash table if -gnatd.A set
+
+ if Debug.Debug_Flag_Dot_AA then
+ Aspects.Tree_Write;
+ end if;
+
Atree.Tree_Write;
Elists.Tree_Write;
Fname.Tree_Write;
===================================================================
@@ -118,7 +118,7 @@ package body Debug is
-- d.y
-- d.z
- -- d.A Properly defer address aspect
+ -- d.A Read/write Aspect_Specifications hash table to tree
-- d.B
-- d.C Generate concatenation call, do not generate inline code
-- d.D
@@ -558,11 +558,10 @@ package body Debug is
-- d.w This flag turns off the scanning of loops to detect possible
-- infinite loops.
- -- d.A Properly defer address aspect. In the case where the expression
- -- of an address aspect is non-static, we should defer the evaluation
- -- of the expression till the freeze point, but this does not seem to
- -- work properly. So we have this debug switch temporarily so that we
- -- can easily investigate this problem.
+ -- d.A There seems to be a problem with ASIS if we activate the circuit
+ -- for reading and writing the aspect specification hash table, so
+ -- for now, this is controlled by the debug flag d.A. The hash table
+ -- is only written and read if this flag is set.
-- d.x No exception handlers in generated code. This causes exception
-- handlers to be eliminated from the generated code. They are still
===================================================================
@@ -32,6 +32,7 @@
with Aspects;
with Atree;
with Csets;
+with Debug;
with Elists;
with Fname;
with Lib;
@@ -51,7 +52,13 @@ procedure Tree_In (Desc : File_Descripto
begin
Tree_IO.Tree_Read_Initialize (Desc);
Opt.Tree_Read;
- Aspects.Tree_Read;
+
+ -- For now, only read aspect specifications hash table if -gnatd.A is set
+
+ if Debug.Debug_Flag_Dot_AA then
+ Aspects.Tree_Read;
+ end if;
+
Atree.Tree_Read;
Elists.Tree_Read;
Fname.Tree_Read;
===================================================================
@@ -26,7 +26,6 @@
with Aspects; use Aspects;
with Atree; use Atree;
with Checks; use Checks;
-with Debug; use Debug;
with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
@@ -765,7 +764,8 @@ package body Sem_Ch13 is
-- Aspects corresponding to attribute definition clauses with
-- the exception of Address which is treated specially.
- when Aspect_Alignment |
+ when Aspect_Address |
+ Aspect_Alignment |
Aspect_Bit_Order |
Aspect_Component_Size |
Aspect_External_Tag |
@@ -780,6 +780,8 @@ package body Sem_Ch13 is
-- Preanalyze the expression with the appropriate type
case A_Id is
+ when Aspect_Address =>
+ T := RTE (RE_Address);
when Aspect_Bit_Order =>
T := RTE (RE_Bit_Order);
when Aspect_External_Tag =>
@@ -811,38 +813,6 @@ package body Sem_Ch13 is
Delay_Required := True;
end if;
- -- Address aspect, treated specially because we have some
- -- strange problem in the back end if we try to delay ???
-
- when Aspect_Address =>
-
- -- Construct the attribute definition clause
-
- Aitem :=
- Make_Attribute_Definition_Clause (Sloc (Aspect),
- Name => Ent,
- Chars => Chars (Id),
- Expression => Relocate_Node (Expr));
-
- -- If -gnatd.A is set, do the delay if needed (this is
- -- so we can debug the relevant problem).
-
- if Debug_Flag_Dot_AA then
- Preanalyze_Spec_Expression
- (Expression (Aitem), RTE (RE_Address));
-
- if Is_OK_Static_Expression (Expression (Aitem)) then
- Delay_Required := False;
- else
- Delay_Required := True;
- end if;
-
- -- Here if -gnatd.A not set, never do the delay
-
- else
- Delay_Required := False;
- end if;
-
-- Aspects corresponding to pragmas with two arguments, where
-- the first argument is a local name referring to the entity,
-- and the second argument is the aspect definition expression.
@@ -1190,8 +1160,8 @@ package body Sem_Ch13 is
A : Node_Id;
begin
- -- Nothing to do if this attribute definition clause comes from an
- -- aspect specification, since we could not be duplicating an
+ -- Nothing to do if this attribute definition clause comes from
+ -- an aspect specification, since we could not be duplicating an
-- explicit clause, and we dealt with the case of duplicated aspects
-- in Analyze_Aspect_Specifications.
@@ -5022,17 +4992,6 @@ package body Sem_Ch13 is
-- Start of processing for Rep_Item_Too_Late
begin
- -- If this is from an aspect that was delayed till the freeze point,
- -- then we skip this check entirely, since it is not required and
- -- furthermore can generate false errors. Also we don't need to chain
- -- the item into the rep item chain in that case, it is already there!
-
- if Nkind_In (N, N_Attribute_Definition_Clause, N_Pragma)
- and then Is_Delayed_Aspect (N)
- then
- return False;
- end if;
-
-- First make sure entity is not frozen (RM 13.1(9)). Exclude imported
-- types, which may be frozen if they appear in a representation clause
-- for a local type.
This patch cleans up a glitch in handling address clauses that caused difficulty in the delay case, this is now fixed, and address clauses are properly delayed as seen from this test, which compiles and executes quietly with -gnat12 -gnata 1. with System; use System; 2. with System.Storage_Elements; 3. use System.Storage_Elements; 4. procedure Delayaddr is 5. A : Integer; 6. type R is new integer range 1 .. 2; 7. AA : constant Address := A'Address; 8. B : Integer with Address => AA + R'Size - 8; 9. for R'Size use 8; 10. begin 11. pragma Assert (A'Address = B'Address); 12. end; Prior to this patch, this program was rejected since R was prematurely frozen in line 8, resulting in the rejection of the rep clause in line 9. Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-11 Robert Dewar <dewar@adacore.com> * debug.adb: Remove d.A flag to delay address clause (not needed any more). Add d.A flag to enable tree read/write of aspect spec hash table * sem_ch13.adb (Analyze_Aspect_Specifications): Properly delay address clause. (Rep_Item_Too_Late): No need for special processing for delayed rep items (and it caused difficulties in the address case). * tree_gen.adb: Only write aspect spec hash table if -gnatd.A is set * tree_in.adb: Only write aspect spec hash table if -gnatd.A is set