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]

[Ada] Defend against bad use of 'Image in HIE mode


Checked in for Robert.

  -Geert

2001-10-25  Robert Dewar <dewar@gnat.com>

	* exp_imgv.adb (Expand_Image_Attribute): Defend against bad use 
        in HIE mode, avoids compilation abandoned message
	
	* exp_imgv.adb: Correct typo in previous change
	
	* exp_imgv.adb: Correct typo in previous change (not my day!)

*** exp_imgv.adb	2001/06/20 19:09:59	1.4
--- exp_imgv.adb	2001/10/05 13:33:14	1.5
***************
*** 227,243 ****
     --  is 32/16/8 depending on the element type of Lit_Indexes.
  
     procedure Expand_Image_Attribute (N : Node_Id) is
!       Loc     : constant Source_Ptr := Sloc (N);
!       Exprs   : constant List_Id    := Expressions (N);
!       Pref    : constant Node_Id    := Prefix (N);
!       Ptyp    : constant Entity_Id  := Entity (Pref);
!       Rtyp    : constant Entity_Id  := Root_Type (Ptyp);
!       Expr    : constant Node_Id    := Relocate_Node (First (Exprs));
!       Imid    : RE_Id;
!       Tent    : Entity_Id;
!       Arglist : List_Id;
!       Func    : RE_Id;
!       Ttyp    : Entity_Id;
  
     begin
        if Rtyp = Standard_Boolean then
--- 227,244 ----
     --  is 32/16/8 depending on the element type of Lit_Indexes.
  
     procedure Expand_Image_Attribute (N : Node_Id) is
!       Loc      : constant Source_Ptr := Sloc (N);
!       Exprs    : constant List_Id    := Expressions (N);
!       Pref     : constant Node_Id    := Prefix (N);
!       Ptyp     : constant Entity_Id  := Entity (Pref);
!       Rtyp     : constant Entity_Id  := Root_Type (Ptyp);
!       Expr     : constant Node_Id    := Relocate_Node (First (Exprs));
!       Imid     : RE_Id;
!       Tent     : Entity_Id;
!       Arglist  : List_Id;
!       Func     : RE_Id;
!       Ttyp     : Entity_Id;
!       Func_Ent : Entity_Id;
  
     begin
        if Rtyp = Standard_Boolean then
***************
*** 347,353 ****
        end if;
  
        --  If we fall through, we have one of the cases that is handled by
!       --  calling one of the System.Img_xx routines.
  
        Arglist := New_List (Convert_To (Tent, Relocate_Node (Expr)));
  
--- 348,367 ----
        end if;
  
        --  If we fall through, we have one of the cases that is handled by
!       --  calling one of the System.Img_xx routines and Func is set to the
!       --  RE_Id for the function to be called.
! 
!       Func_Ent := RTE (Func);
! 
!       --  If the function entity is empty, that means we have a case in
!       --  no run time mode where the operation is not allowed, and an
!       --  appropriate diagnostic has already been issued.
! 
!       if No (Func_Ent) then
!          return;
!       end if;
! 
!       --  Otherwise prepare arguments for run-time call
  
        Arglist := New_List (Convert_To (Tent, Relocate_Node (Expr)));
  

*** exp_imgv.adb	2001/10/05 13:33:14	1.5
--- exp_imgv.adb	2001/10/05 13:41:37	1.6
***************
*** 348,357 ****
        end if;
  
        --  If we fall through, we have one of the cases that is handled by
!       --  calling one of the System.Img_xx routines and Func is set to the
        --  RE_Id for the function to be called.
  
!       Func_Ent := RTE (Func);
  
        --  If the function entity is empty, that means we have a case in
        --  no run time mode where the operation is not allowed, and an
--- 348,357 ----
        end if;
  
        --  If we fall through, we have one of the cases that is handled by
!       --  calling one of the System.Img_xx routines and Im_Id is set to the
        --  RE_Id for the function to be called.
  
!       Func_Ent := RTE (Im_Id);
  
        --  If the function entity is empty, that means we have a case in
        --  no run time mode where the operation is not allowed, and an
***************
*** 402,408 ****
  
        Rewrite (N,
          Make_Function_Call (Loc,
!           Name => New_Reference_To (RTE (Imid), Loc),
            Parameter_Associations => Arglist));
  
        Analyze_And_Resolve (N, Standard_String);
--- 402,408 ----
  
        Rewrite (N,
          Make_Function_Call (Loc,
!           Name => New_Reference_To (Func_Ent, Loc),
            Parameter_Associations => Arglist));
  
        Analyze_And_Resolve (N, Standard_String);

*** exp_imgv.adb	2001/10/05 13:41:37	1.6
--- exp_imgv.adb	2001/10/05 13:44:32	1.7
***************
*** 348,357 ****
        end if;
  
        --  If we fall through, we have one of the cases that is handled by
!       --  calling one of the System.Img_xx routines and Im_Id is set to the
        --  RE_Id for the function to be called.
  
!       Func_Ent := RTE (Im_Id);
  
        --  If the function entity is empty, that means we have a case in
        --  no run time mode where the operation is not allowed, and an
--- 348,357 ----
        end if;
  
        --  If we fall through, we have one of the cases that is handled by
!       --  calling one of the System.Img_xx routines and Imid is set to the
        --  RE_Id for the function to be called.
  
!       Func_Ent := RTE (Imid);
  
        --  If the function entity is empty, that means we have a case in
        --  no run time mode where the operation is not allowed, and an


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