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] Reflect ACT changes of 2001-10-28, part 2


These got left out from the previous check in. -Geert

2001-12-11  Ed Schonberg <schonber@gnat.com>

	* sem_ch3.adb: Clarify some ???.
	
2001-12-11  Robert Dewar <dewar@gnat.com>

	* exp_util.adb (Must_Be_Aligned): Removed, replaced by 
	Exp_Pakd.Known_Aligned_Enough
	
	* sem_ch13.adb (Check_Address_Alignment): Removed, extended 
	version is moved to Exp_Ch13.

*** sem_ch3.adb	2001/10/25 02:50:54	1.1362
--- sem_ch3.adb	2001/10/28 00:10:34	1.1363
***************
*** 7308,7314 ****
        Suffix_Index : Nat)
     is
        Def_Id     : Entity_Id;
!       R          : Node_Id;
        Checks_Off : Boolean := False;
        T          : constant Entity_Id := Etype (Index);
  
--- 7308,7314 ----
        Suffix_Index : Nat)
     is
        Def_Id     : Entity_Id;
!       R          : Node_Id := Empty;
        Checks_Off : Boolean := False;
        T          : constant Entity_Id := Etype (Index);
  
***************
*** 7410,7417 ****
        Set_RM_Size        (Def_Id, RM_Size        (T));
        Set_First_Rep_Item (Def_Id, First_Rep_Item (T));
  
-       --  ??? ??? is R always initialized, not at all obvious why?
- 
        Set_Scalar_Range   (Def_Id, R);
  
        Set_Etype (S, Def_Id);
--- 7410,7415 ----
***************
*** 10334,10346 ****
        elsif Nkind (I) = N_Attribute_Reference then
  
           --  The parser guarantees that the attribute is a RANGE attribute
- 
-          --  Is order critical here (setting T before Resolve). If so,
-          --  document why, if not use Analyze_And_Resolve and get T after???
  
!          Analyze (I);
           T := Etype (I);
-          Resolve (I, T);
           R := I;
  
        --  If none of the above, must be a subtype. We convert this to a
--- 10332,10340 ----
        elsif Nkind (I) = N_Attribute_Reference then
  
           --  The parser guarantees that the attribute is a RANGE attribute
  
!          Analyze_And_Resolve (I);
           T := Etype (I);
           R := I;
  
        --  If none of the above, must be a subtype. We convert this to a

*** exp_util.adb	2001/10/23 13:51:25	1.337
--- exp_util.adb	2001/10/28 15:13:52	1.338
***************
*** 2488,2588 ****
        end if;
     end May_Generate_Large_Temp;
  
-    ---------------------
-    -- Must_Be_Aligned --
-    ---------------------
- 
-    function Must_Be_Aligned (Obj : Node_Id) return Boolean is
-       Typ : constant Entity_Id := Etype (Obj);
- 
-       function In_Partially_Packed_Record (Comp : Entity_Id) return Boolean;
-       --  If the component is in a record that contains previous packed
-       --  components, consider it unaligned because the back-end might
-       --  choose to pack the rest of the record. Lead to less efficient code,
-       --  but safer vis-a-vis of back-end choices.
- 
-       -----------------------------
-       -- Partially_Packed_Record --
-       -----------------------------
- 
-       function In_Partially_Packed_Record (Comp : Entity_Id) return Boolean is
-          Rec_Type  : constant Entity_Id := Scope (Comp);
-          Prev_Comp : Entity_Id;
- 
-       begin
-          Prev_Comp := First_Entity (Rec_Type);
-          while Present (Prev_Comp) loop
-             if Is_Packed (Etype (Prev_Comp)) then
-                return True;
- 
-             elsif Prev_Comp = Comp then
-                return False;
-             end if;
- 
-             Next_Entity (Prev_Comp);
-          end loop;
- 
-          return False;
-       end  In_Partially_Packed_Record;
- 
-    --  Start of processing for Must_Be_Aligned
- 
-    begin
-       --  If object is strictly aligned, we can quit now
- 
-       if Strict_Alignment (Typ) then
-          return True;
- 
-       --  Case of subscripted array reference
- 
-       elsif Nkind (Obj) = N_Indexed_Component then
- 
-          --  If we have a pointer to an array, then this is definitely
-          --  aligned, because pointers always point to aligned versions.
- 
-          if Is_Access_Type (Etype (Prefix (Obj))) then
-             return True;
- 
-          --  Otherwise, go look at the prefix
- 
-          else
-             return Must_Be_Aligned (Prefix (Obj));
-          end if;
- 
-       --  Case of record field
- 
-       elsif Nkind (Obj) = N_Selected_Component then
- 
-          --  What is significant here is whether the record type is packed
- 
-          if Is_Record_Type (Etype (Prefix (Obj)))
-            and then Is_Packed (Etype (Prefix (Obj)))
-          then
-             return False;
- 
-          --  Or the component has a component clause which might cause
-          --  the component to become unaligned (we can't tell if the
-          --  backend is doing alignment computations).
- 
-          elsif Present (Component_Clause (Entity (Selector_Name (Obj)))) then
-             return False;
- 
-          elsif In_Partially_Packed_Record (Entity (Selector_Name (Obj))) then
-             return False;
- 
-          --  In all other cases, go look at prefix
- 
-          else
-             return Must_Be_Aligned (Prefix (Obj));
-          end if;
- 
-       --  If not selected or indexed component, must be aligned
- 
-       else
-          return True;
-       end if;
-    end Must_Be_Aligned;
- 
     ----------------------------
     -- New_Class_Wide_Subtype --
     ----------------------------
--- 2488,2493 ----

*** sem_ch13.adb	2001/09/22 03:52:02	1.390
--- sem_ch13.adb	2001/10/28 15:14:41	1.391
***************
*** 27,32 ****
--- 27,33 ----
  ------------------------------------------------------------------------------
  
  with Atree;    use Atree;
+ with Checks;   use Checks;
  with Einfo;    use Einfo;
  with Errout;   use Errout;
  with Exp_Tss;  use Exp_Tss;
***************
*** 68,81 ****
     --  inherited from a derived type that is no longer appropriate for the
     --  new Esize value. In this case, we reset the Alignment to unknown.
  
-    procedure Check_Address_Alignment (E : Entity_Id; Expr : Node_Id);
-    --  Given an object entity E, for which the alignment is known, checks
-    --  to see if Expr (the expression from an Address clause) is a known
-    --  at compile time value, and if so posts a warning if the value is
-    --  not consistent with the known alignment requirement. This is not
-    --  an error, but rather leads to erroneous behavior, but we certainly
-    --  may as well give a warning if we detect this situation.
- 
     procedure Check_Component_Overlap (C1_Ent, C2_Ent : Entity_Id);
     --  Given two entities for record components or discriminants, checks
     --  if they hav overlapping component clauses and issues errors if so.
--- 69,74 ----
***************
*** 315,321 ****
  
                 Check_Constant_Address_Clause (Expr, U_Ent);
  
!             --  Case of address clause for variable or constant
  
              elsif
                Ekind (U_Ent) = E_Variable
--- 308,314 ----
  
                 Check_Constant_Address_Clause (Expr, U_Ent);
  
!             --  Case of address clause for an object
  
              elsif
                Ekind (U_Ent) = E_Variable
***************
*** 398,407 ****
                       Warn_Overlay (Expr, Typ, Nam);
                    end if;
  
!                   --  Check for bad alignment
  
!                   if Known_Alignment (U_Ent) then
!                      Check_Address_Alignment (U_Ent, Expr);
                    end if;
  
                    --  Kill the size check code, since we are not allocating
--- 391,402 ----
                       Warn_Overlay (Expr, Typ, Nam);
                    end if;
  
!                   --  If entity has delayed freeze then we will generate
!                   --  an alignment check at the freeze point. If there is
!                   --  no delayed freeze we can do it right now.
  
!                   if not Has_Delayed_Freeze (U_Ent) then
!                      Apply_Alignment_Check (U_Ent, N);
                    end if;
  
                    --  Kill the size check code, since we are not allocating
***************
*** 2319,2359 ****
        end if;
  
     end Analyze_Record_Representation_Clause;
- 
-    -----------------------------
-    -- Check_Address_Alignment --
-    -----------------------------
- 
-    procedure Check_Address_Alignment (E : Entity_Id; Expr : Node_Id) is
-       Arg : Node_Id;
- 
-    begin
-       if Nkind (Expr) = N_Unchecked_Type_Conversion then
-          Arg := Expression (Expr);
- 
-       elsif Nkind (Expr) = N_Function_Call
-         and then Is_RTE (Entity (Name (Expr)), RE_To_Address)
-       then
-          Arg := First (Parameter_Associations (Expr));
- 
-          if Nkind (Arg) = N_Parameter_Association then
-             Arg := Explicit_Actual_Parameter (Arg);
-          end if;
- 
-       else
-          return;
-       end if;
- 
-       --  Here Arg is the address value
- 
-       if Compile_Time_Known_Value (Arg) then
-          if Expr_Value (Arg) mod Alignment (E) /= 0 then
-             Error_Msg_NE
-               ("?specified address for& not consistent with alignment",
-                Arg, E);
-          end if;
-       end if;
-    end Check_Address_Alignment;
  
     -----------------------------
     -- Check_Component_Overlap --
--- 2314,2319 ----


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