OSDN Git Service

* gcc-interface/utils2.c (build_unary_op) <ATTR_ADDR_EXPR>: Do not
[pf3gnuchains/gcc-fork.git] / gcc / ada / sem.adb
index 6f68bdd..caa73a0 100644 (file)
@@ -243,7 +243,7 @@ package body Sem is
             Analyze_Free_Statement (N);
 
          when N_Freeze_Entity =>
-            null;  -- no semantic processing required
+            Analyze_Freeze_Entity (N);
 
          when N_Full_Type_Declaration =>
             Analyze_Type_Declaration (N);
@@ -603,6 +603,19 @@ package body Sem is
          when N_Push_Pop_xxx_Label =>
             null;
 
+         --  SCIL nodes don't need analysis because they are decorated when
+         --  they are built. They are added to the tree by Insert_Actions and
+         --  the call to analyze them is generated when the full list is
+         --  analyzed.
+
+         when
+           N_SCIL_Dispatch_Table_Object_Init        |
+           N_SCIL_Dispatch_Table_Tag_Init           |
+           N_SCIL_Dispatching_Call                  |
+           N_SCIL_Membership_Test                   |
+           N_SCIL_Tag_Init                          =>
+            null;
+
          --  For the remaining node types, we generate compiler abort, because
          --  these nodes are always analyzed within the Sem_Chn routines and
          --  there should never be a case of making a call to the main Analyze
@@ -1680,8 +1693,16 @@ package body Sem is
          --------------------
 
          procedure Do_Withed_Unit (Withed_Unit : Node_Id) is
+            Save_Do_Main : constant Boolean := Do_Main;
+
          begin
+            --  Do not process the main unit if coming from a with_clause,
+            --  as would happen with a parent body that has a child spec
+            --  in its context.
+
+            Do_Main := False;
             Do_Unit_And_Dependents (Withed_Unit, Unit (Withed_Unit));
+            Do_Main := Save_Do_Main;
          end Do_Withed_Unit;
 
          procedure Do_Withed_Units is new Walk_Withs (Do_Withed_Unit);
@@ -1865,17 +1886,16 @@ package body Sem is
             Main_CU : constant Node_Id := Cunit (Main_Unit);
 
          begin
-
-            --  If the main unit is an instantiation, the body appears
-            --  before the instance spec, which is added later to the
-            --  unit list. Do the spec if present, body will follow.
+            --  If the main unit is an instantiation, the body appears before
+            --  the instance spec, which is added later to the unit list. Do
+            --  the spec if present, body will follow.
 
             if Nkind (Original_Node (Unit (Main_CU)))
-            in N_Generic_Instantiation
+                 in N_Generic_Instantiation
               and then Present (Library_Unit (Main_CU))
             then
                Do_Unit_And_Dependents
-              (Library_Unit (Main_CU), Unit (Library_Unit (Main_CU)));
+                 (Library_Unit (Main_CU), Unit (Library_Unit (Main_CU)));
             else
                Do_Unit_And_Dependents (Main_CU, Unit (Main_CU));
             end if;
@@ -1957,9 +1977,9 @@ package body Sem is
                   end loop;
 
                   --  See if it belongs to current unit, and if so, include its
-                  --  with_clauses.
+                  --  with_clauses. Do not process main unit prematurely.
 
-                  if Pnode = CU then
+                  if Pnode = CU and then CU /= Cunit (Main_Unit) then
                      Walk_Immediate (Cunit (S), Include_Limited);
                   end if;
                end;