1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Atree
; use Atree
;
27 with Checks
; use Checks
;
28 with Einfo
; use Einfo
;
29 with Elists
; use Elists
;
30 with Errout
; use Errout
;
31 with Expander
; use Expander
;
32 with Exp_Atag
; use Exp_Atag
;
33 with Exp_Ch4
; use Exp_Ch4
;
34 with Exp_Ch7
; use Exp_Ch7
;
35 with Exp_Ch11
; use Exp_Ch11
;
36 with Exp_Code
; use Exp_Code
;
37 with Exp_Fixd
; use Exp_Fixd
;
38 with Exp_Util
; use Exp_Util
;
39 with Freeze
; use Freeze
;
40 with Inline
; use Inline
;
41 with Nmake
; use Nmake
;
42 with Nlists
; use Nlists
;
44 with Restrict
; use Restrict
;
45 with Rident
; use Rident
;
46 with Rtsfind
; use Rtsfind
;
48 with Sem_Aux
; use Sem_Aux
;
49 with Sem_Eval
; use Sem_Eval
;
50 with Sem_Res
; use Sem_Res
;
51 with Sem_Type
; use Sem_Type
;
52 with Sem_Util
; use Sem_Util
;
53 with Sinfo
; use Sinfo
;
54 with Sinput
; use Sinput
;
55 with Snames
; use Snames
;
56 with Stand
; use Stand
;
57 with Tbuild
; use Tbuild
;
58 with Uintp
; use Uintp
;
59 with Urealp
; use Urealp
;
61 package body Exp_Intr
is
63 -----------------------
64 -- Local Subprograms --
65 -----------------------
67 procedure Expand_Binary_Operator_Call
(N
: Node_Id
);
68 -- Expand a call to an intrinsic arithmetic operator when the operand
69 -- types or sizes are not identical.
71 procedure Expand_Is_Negative
(N
: Node_Id
);
72 -- Expand a call to the intrinsic Is_Negative function
74 procedure Expand_Dispatching_Constructor_Call
(N
: Node_Id
);
75 -- Expand a call to an instantiation of Generic_Dispatching_Constructor
76 -- into a dispatching call to the actual subprogram associated with the
77 -- Constructor formal subprogram, passing it the Parameters actual of
78 -- the call to the instantiation and dispatching based on call's Tag
81 procedure Expand_Exception_Call
(N
: Node_Id
; Ent
: RE_Id
);
82 -- Expand a call to Exception_Information/Message/Name. The first
83 -- parameter, N, is the node for the function call, and Ent is the
84 -- entity for the corresponding routine in the Ada.Exceptions package.
86 procedure Expand_Import_Call
(N
: Node_Id
);
87 -- Expand a call to Import_Address/Longest_Integer/Value. The parameter
88 -- N is the node for the function call.
90 procedure Expand_Shift
(N
: Node_Id
; E
: Entity_Id
; K
: Node_Kind
);
91 -- Expand an intrinsic shift operation, N and E are from the call to
92 -- Expand_Intrinsic_Call (call node and subprogram spec entity) and
93 -- K is the kind for the shift node
95 procedure Expand_Unc_Conversion
(N
: Node_Id
; E
: Entity_Id
);
96 -- Expand a call to an instantiation of Unchecked_Conversion into a node
97 -- N_Unchecked_Type_Conversion.
99 procedure Expand_Unc_Deallocation
(N
: Node_Id
);
100 -- Expand a call to an instantiation of Unchecked_Deallocation into a node
101 -- N_Free_Statement and appropriate context.
103 procedure Expand_To_Address
(N
: Node_Id
);
104 procedure Expand_To_Pointer
(N
: Node_Id
);
105 -- Expand a call to corresponding function, declared in an instance of
106 -- System.Address_To_Access_Conversions.
108 procedure Expand_Source_Info
(N
: Node_Id
; Nam
: Name_Id
);
109 -- Rewrite the node as the appropriate string literal or positive
110 -- constant. Nam is the name of one of the intrinsics declared in
111 -- GNAT.Source_Info; see g-souinf.ads for documentation of these
114 procedure Append_Entity_Name
(Buf
: in out Bounded_String
; E
: Entity_Id
);
115 -- Recursive procedure to construct string for qualified name of enclosing
116 -- program unit. The qualification stops at an enclosing scope has no
117 -- source name (block or loop). If entity is a subprogram instance, skip
118 -- enclosing wrapper package. The name is appended to Buf.
120 ---------------------
121 -- Add_Source_Info --
122 ---------------------
124 procedure Add_Source_Info
125 (Buf
: in out Bounded_String
;
132 Append
(Buf
, Nat
(Get_Logical_Line_Number
(Loc
)));
135 Append_Decoded
(Buf
, Reference_Name
(Get_Source_File_Index
(Loc
)));
137 when Name_Source_Location
=>
138 Build_Location_String
(Buf
, Loc
);
140 when Name_Enclosing_Entity
=>
142 -- Skip enclosing blocks to reach enclosing unit
145 Ent
: Entity_Id
:= Current_Scope
;
147 while Present
(Ent
) loop
148 exit when not Ekind_In
(Ent
, E_Block
, E_Loop
);
152 -- Ent now points to the relevant defining entity
154 Append_Entity_Name
(Buf
, Ent
);
157 when Name_Compilation_ISO_Date
=>
158 Append
(Buf
, Opt
.Compilation_Time
(1 .. 10));
160 when Name_Compilation_Date
=>
162 subtype S13
is String (1 .. 3);
163 Months
: constant array (1 .. 12) of S13
:=
164 ("Jan", "Feb", "Mar", "Apr", "May", "Jun",
165 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
167 M1
: constant Character := Opt
.Compilation_Time
(6);
168 M2
: constant Character := Opt
.Compilation_Time
(7);
170 MM
: constant Natural range 1 .. 12 :=
171 (Character'Pos (M1
) - Character'Pos ('0')) * 10 +
172 (Character'Pos (M2
) - Character'Pos ('0'));
175 -- Reformat ISO date into MMM DD YYYY (__DATE__) format
177 Append
(Buf
, Months
(MM
));
179 Append
(Buf
, Opt
.Compilation_Time
(9 .. 10));
181 Append
(Buf
, Opt
.Compilation_Time
(1 .. 4));
184 when Name_Compilation_Time
=>
185 Append
(Buf
, Opt
.Compilation_Time
(12 .. 19));
192 -----------------------
193 -- Append_Entity_Name --
194 -----------------------
196 procedure Append_Entity_Name
(Buf
: in out Bounded_String
; E
: Entity_Id
) is
197 Temp
: Bounded_String
;
199 procedure Inner
(E
: Entity_Id
);
200 -- Inner recursive routine, keep outer routine nonrecursive to ease
201 -- debugging when we get strange results from this routine.
207 procedure Inner
(E
: Entity_Id
) is
209 -- If entity has an internal name, skip by it, and print its scope.
210 -- Note that we strip a final R from the name before the test; this
211 -- is needed for some cases of instantiations.
214 E_Name
: Bounded_String
;
217 Append
(E_Name
, Chars
(E
));
219 if E_Name
.Chars
(E_Name
.Length
) = 'R' then
220 E_Name
.Length
:= E_Name
.Length
- 1;
223 if Is_Internal_Name
(E_Name
) then
229 -- Just print entity name if its scope is at the outer level
231 if Scope
(E
) = Standard_Standard
then
234 -- If scope comes from source, write scope and entity
236 elsif Comes_From_Source
(Scope
(E
)) then
237 Append_Entity_Name
(Temp
, Scope
(E
));
240 -- If in wrapper package skip past it
242 elsif Is_Wrapper_Package
(Scope
(E
)) then
243 Append_Entity_Name
(Temp
, Scope
(Scope
(E
)));
246 -- Otherwise nothing to output (happens in unnamed block statements)
255 E_Name
: Bounded_String
;
258 Append_Unqualified_Decoded
(E_Name
, Chars
(E
));
260 -- Remove trailing upper-case letters from the name (useful for
261 -- dealing with some cases of internal names generated in the case
262 -- of references from within a generic).
264 while E_Name
.Length
> 1
265 and then E_Name
.Chars
(E_Name
.Length
) in 'A' .. 'Z'
267 E_Name
.Length
:= E_Name
.Length
- 1;
270 -- Adjust casing appropriately (gets name from source if possible)
272 Adjust_Name_Case
(E_Name
, Sloc
(E
));
273 Append
(Temp
, E_Name
);
277 -- Start of processing for Append_Entity_Name
282 end Append_Entity_Name
;
284 ---------------------------------
285 -- Expand_Binary_Operator_Call --
286 ---------------------------------
288 procedure Expand_Binary_Operator_Call
(N
: Node_Id
) is
289 T1
: constant Entity_Id
:= Underlying_Type
(Etype
(Left_Opnd
(N
)));
290 T2
: constant Entity_Id
:= Underlying_Type
(Etype
(Right_Opnd
(N
)));
291 TR
: constant Entity_Id
:= Etype
(N
);
295 Siz
: constant Uint
:= UI_Max
(RM_Size
(T1
), RM_Size
(T2
));
296 -- Maximum of operand sizes
299 -- Nothing to do if the operands have the same modular type
301 if Base_Type
(T1
) = Base_Type
(T2
)
302 and then Is_Modular_Integer_Type
(T1
)
307 -- Use Unsigned_32 for sizes of 32 or below, else Unsigned_64
310 T3
:= RTE
(RE_Unsigned_64
);
312 T3
:= RTE
(RE_Unsigned_32
);
315 -- Copy operator node, and reset type and entity fields, for
316 -- subsequent reanalysis.
322 when N_Op_And
=> Set_Entity
(Res
, Standard_Op_And
);
323 when N_Op_Or
=> Set_Entity
(Res
, Standard_Op_Or
);
324 when N_Op_Xor
=> Set_Entity
(Res
, Standard_Op_Xor
);
325 when others => raise Program_Error
;
328 -- Convert operands to large enough intermediate type
331 Unchecked_Convert_To
(T3
, Relocate_Node
(Left_Opnd
(N
))));
333 Unchecked_Convert_To
(T3
, Relocate_Node
(Right_Opnd
(N
))));
335 -- Analyze and resolve result formed by conversion to target type
337 Rewrite
(N
, Unchecked_Convert_To
(TR
, Res
));
338 Analyze_And_Resolve
(N
, TR
);
339 end Expand_Binary_Operator_Call
;
341 -----------------------------------------
342 -- Expand_Dispatching_Constructor_Call --
343 -----------------------------------------
345 -- Transform a call to an instantiation of Generic_Dispatching_Constructor
348 -- GDC_Instance (The_Tag, Parameters'Access)
350 -- to a class-wide conversion of a dispatching call to the actual
351 -- associated with the formal subprogram Construct, designating The_Tag
352 -- as the controlling tag of the call:
354 -- T'Class (Construct'Actual (Params)) -- Controlling tag is The_Tag
356 -- which will eventually be expanded to the following:
358 -- T'Class (The_Tag.all (Construct'Actual'Index).all (Params))
360 -- A class-wide membership test is also generated, preceding the call, to
361 -- ensure that the controlling tag denotes a type in T'Class.
363 procedure Expand_Dispatching_Constructor_Call
(N
: Node_Id
) is
364 Loc
: constant Source_Ptr
:= Sloc
(N
);
365 Tag_Arg
: constant Node_Id
:= First_Actual
(N
);
366 Param_Arg
: constant Node_Id
:= Next_Actual
(Tag_Arg
);
367 Subp_Decl
: constant Node_Id
:= Parent
(Parent
(Entity
(Name
(N
))));
368 Inst_Pkg
: constant Node_Id
:= Parent
(Subp_Decl
);
369 Act_Rename
: Node_Id
;
370 Act_Constr
: Entity_Id
;
371 Iface_Tag
: Node_Id
:= Empty
;
372 Cnstr_Call
: Node_Id
;
373 Result_Typ
: Entity_Id
;
376 -- Remove side effects from tag argument early, before rewriting
377 -- the dispatching constructor call, as Remove_Side_Effects relies
378 -- on Tag_Arg's Parent link properly attached to the tree (once the
379 -- call is rewritten, the Parent is inconsistent as it points to the
380 -- rewritten node, which is not the syntactic parent of the Tag_Arg
383 Remove_Side_Effects
(Tag_Arg
);
385 -- Check that we have a proper tag
388 Make_Implicit_If_Statement
(N
,
389 Condition
=> Make_Op_Eq
(Loc
,
390 Left_Opnd
=> New_Copy_Tree
(Tag_Arg
),
391 Right_Opnd
=> New_Occurrence_Of
(RTE
(RE_No_Tag
), Loc
)),
393 Then_Statements
=> New_List
(
394 Make_Raise_Statement
(Loc
,
395 New_Occurrence_Of
(RTE
(RE_Tag_Error
), Loc
)))));
397 -- Check that it is not the tag of an abstract type
400 Make_Implicit_If_Statement
(N
,
401 Condition
=> Make_Function_Call
(Loc
,
403 New_Occurrence_Of
(RTE
(RE_Is_Abstract
), Loc
),
404 Parameter_Associations
=> New_List
(New_Copy_Tree
(Tag_Arg
))),
406 Then_Statements
=> New_List
(
407 Make_Raise_Statement
(Loc
,
408 New_Occurrence_Of
(RTE
(RE_Tag_Error
), Loc
)))));
410 -- The subprogram is the third actual in the instantiation, and is
411 -- retrieved from the corresponding renaming declaration. However,
412 -- freeze nodes may appear before, so we retrieve the declaration
413 -- with an explicit loop.
415 Act_Rename
:= First
(Visible_Declarations
(Inst_Pkg
));
416 while Nkind
(Act_Rename
) /= N_Subprogram_Renaming_Declaration
loop
420 Act_Constr
:= Entity
(Name
(Act_Rename
));
421 Result_Typ
:= Class_Wide_Type
(Etype
(Act_Constr
));
423 -- Check that the accessibility level of the tag is no deeper than that
424 -- of the constructor function (unless CodePeer_Mode)
426 if not CodePeer_Mode
then
428 Make_Implicit_If_Statement
(N
,
432 Build_Get_Access_Level
(Loc
, New_Copy_Tree
(Tag_Arg
)),
434 Make_Integer_Literal
(Loc
, Scope_Depth
(Act_Constr
))),
436 Then_Statements
=> New_List
(
437 Make_Raise_Statement
(Loc
,
438 New_Occurrence_Of
(RTE
(RE_Tag_Error
), Loc
)))));
441 if Is_Interface
(Etype
(Act_Constr
)) then
443 -- If the result type is not known to be a parent of Tag_Arg then we
444 -- need to locate the tag of the secondary dispatch table.
446 if not Is_Ancestor
(Etype
(Result_Typ
), Etype
(Tag_Arg
),
447 Use_Full_View
=> True)
448 and then Tagged_Type_Expansion
450 -- Obtain the reference to the Ada.Tags service before generating
451 -- the Object_Declaration node to ensure that if this service is
452 -- not available in the runtime then we generate a clear error.
455 Fname
: constant Node_Id
:=
456 New_Occurrence_Of
(RTE
(RE_Secondary_Tag
), Loc
);
459 pragma Assert
(not Is_Interface
(Etype
(Tag_Arg
)));
461 -- The tag is the first entry in the dispatch table of the
462 -- return type of the constructor.
465 Make_Object_Declaration
(Loc
,
466 Defining_Identifier
=> Make_Temporary
(Loc
, 'V'),
468 New_Occurrence_Of
(RTE
(RE_Tag
), Loc
),
470 Make_Function_Call
(Loc
,
472 Parameter_Associations
=> New_List
(
473 Relocate_Node
(Tag_Arg
),
476 (Access_Disp_Table
(Etype
(Act_Constr
)))),
478 Insert_Action
(N
, Iface_Tag
);
483 -- Create the call to the actual Constructor function
486 Make_Function_Call
(Loc
,
487 Name
=> New_Occurrence_Of
(Act_Constr
, Loc
),
488 Parameter_Associations
=> New_List
(Relocate_Node
(Param_Arg
)));
490 -- Establish its controlling tag from the tag passed to the instance
491 -- The tag may be given by a function call, in which case a temporary
492 -- should be generated now, to prevent out-of-order insertions during
493 -- the expansion of that call when stack-checking is enabled.
495 if Present
(Iface_Tag
) then
496 Set_Controlling_Argument
(Cnstr_Call
,
497 New_Occurrence_Of
(Defining_Identifier
(Iface_Tag
), Loc
));
499 Set_Controlling_Argument
(Cnstr_Call
,
500 Relocate_Node
(Tag_Arg
));
503 -- Rewrite and analyze the call to the instance as a class-wide
504 -- conversion of the call to the actual constructor.
506 Rewrite
(N
, Convert_To
(Result_Typ
, Cnstr_Call
));
508 -- Do not generate a run-time check on the built object if tag
509 -- checks are suppressed for the result type or tagged type expansion
510 -- is disabled or if CodePeer_Mode.
512 if Tag_Checks_Suppressed
(Etype
(Result_Typ
))
513 or else not Tagged_Type_Expansion
514 or else CodePeer_Mode
518 -- Generate a class-wide membership test to ensure that the call's tag
519 -- argument denotes a type within the class. We must keep separate the
520 -- case in which the Result_Type of the constructor function is a tagged
521 -- type from the case in which it is an abstract interface because the
522 -- run-time subprogram required to check these cases differ (and have
523 -- one difference in their parameters profile).
525 -- Call CW_Membership if the Result_Type is a tagged type to look for
526 -- the tag in the table of ancestor tags.
528 elsif not Is_Interface
(Result_Typ
) then
530 Obj_Tag_Node
: Node_Id
:= New_Copy_Tree
(Tag_Arg
);
531 CW_Test_Node
: Node_Id
;
534 Build_CW_Membership
(Loc
,
535 Obj_Tag_Node
=> Obj_Tag_Node
,
538 Node
(First_Elmt
(Access_Disp_Table
(
539 Root_Type
(Result_Typ
)))), Loc
),
541 New_Node
=> CW_Test_Node
);
544 Make_Implicit_If_Statement
(N
,
546 Make_Op_Not
(Loc
, CW_Test_Node
),
548 New_List
(Make_Raise_Statement
(Loc
,
549 New_Occurrence_Of
(RTE
(RE_Tag_Error
), Loc
)))));
552 -- Call IW_Membership test if the Result_Type is an abstract interface
553 -- to look for the tag in the table of interface tags.
557 Make_Implicit_If_Statement
(N
,
560 Make_Function_Call
(Loc
,
561 Name
=> New_Occurrence_Of
(RTE
(RE_IW_Membership
), Loc
),
562 Parameter_Associations
=> New_List
(
563 Make_Attribute_Reference
(Loc
,
564 Prefix
=> New_Copy_Tree
(Tag_Arg
),
565 Attribute_Name
=> Name_Address
),
568 Node
(First_Elmt
(Access_Disp_Table
(
569 Root_Type
(Result_Typ
)))), Loc
)))),
572 Make_Raise_Statement
(Loc
,
573 Name
=> New_Occurrence_Of
(RTE
(RE_Tag_Error
), Loc
)))));
576 Analyze_And_Resolve
(N
, Etype
(Act_Constr
));
577 end Expand_Dispatching_Constructor_Call
;
579 ---------------------------
580 -- Expand_Exception_Call --
581 ---------------------------
583 -- If the function call is not within an exception handler, then the call
584 -- is replaced by a null string. Otherwise the appropriate routine in
585 -- Ada.Exceptions is called passing the choice parameter specification
586 -- from the enclosing handler. If the enclosing handler lacks a choice
587 -- parameter, then one is supplied.
589 procedure Expand_Exception_Call
(N
: Node_Id
; Ent
: RE_Id
) is
590 Loc
: constant Source_Ptr
:= Sloc
(N
);
595 -- Climb up parents to see if we are in exception handler
599 -- Case of not in exception handler, replace by null string
603 Make_String_Literal
(Loc
,
607 -- Case of in exception handler
609 elsif Nkind
(P
) = N_Exception_Handler
then
611 -- Handler cannot be used for a local raise, and furthermore, this
612 -- is a violation of the No_Exception_Propagation restriction.
614 Set_Local_Raise_Not_OK
(P
);
615 Check_Restriction
(No_Exception_Propagation
, N
);
617 -- If no choice parameter present, then put one there. Note that
618 -- we do not need to put it on the entity chain, since no one will
619 -- be referencing it by normal visibility methods.
621 if No
(Choice_Parameter
(P
)) then
622 E
:= Make_Temporary
(Loc
, 'E');
623 Set_Choice_Parameter
(P
, E
);
624 Set_Ekind
(E
, E_Variable
);
625 Set_Etype
(E
, RTE
(RE_Exception_Occurrence
));
626 Set_Scope
(E
, Current_Scope
);
630 Make_Function_Call
(Loc
,
631 Name
=> New_Occurrence_Of
(RTE
(Ent
), Loc
),
632 Parameter_Associations
=> New_List
(
633 New_Occurrence_Of
(Choice_Parameter
(P
), Loc
))));
643 Analyze_And_Resolve
(N
, Standard_String
);
644 end Expand_Exception_Call
;
646 ------------------------
647 -- Expand_Import_Call --
648 ------------------------
650 -- The function call must have a static string as its argument. We create
651 -- a dummy variable which uses this string as the external name in an
652 -- Import pragma. The result is then obtained as the address of this
653 -- dummy variable, converted to the appropriate target type.
655 procedure Expand_Import_Call
(N
: Node_Id
) is
656 Loc
: constant Source_Ptr
:= Sloc
(N
);
657 Ent
: constant Entity_Id
:= Entity
(Name
(N
));
658 Str
: constant Node_Id
:= First_Actual
(N
);
659 Dum
: constant Entity_Id
:= Make_Temporary
(Loc
, 'D');
662 Insert_Actions
(N
, New_List
(
663 Make_Object_Declaration
(Loc
,
664 Defining_Identifier
=> Dum
,
666 New_Occurrence_Of
(Standard_Character
, Loc
)),
669 Chars
=> Name_Import
,
670 Pragma_Argument_Associations
=> New_List
(
671 Make_Pragma_Argument_Association
(Loc
,
672 Expression
=> Make_Identifier
(Loc
, Name_Ada
)),
674 Make_Pragma_Argument_Association
(Loc
,
675 Expression
=> Make_Identifier
(Loc
, Chars
(Dum
))),
677 Make_Pragma_Argument_Association
(Loc
,
678 Chars
=> Name_Link_Name
,
679 Expression
=> Relocate_Node
(Str
))))));
682 Unchecked_Convert_To
(Etype
(Ent
),
683 Make_Attribute_Reference
(Loc
,
684 Prefix
=> Make_Identifier
(Loc
, Chars
(Dum
)),
685 Attribute_Name
=> Name_Address
)));
687 Analyze_And_Resolve
(N
, Etype
(Ent
));
688 end Expand_Import_Call
;
690 ---------------------------
691 -- Expand_Intrinsic_Call --
692 ---------------------------
694 procedure Expand_Intrinsic_Call
(N
: Node_Id
; E
: Entity_Id
) is
698 -- If an external name is specified for the intrinsic, it is handled
699 -- by the back-end: leave the call node unchanged for now.
701 if Present
(Interface_Name
(E
)) then
705 -- If the intrinsic subprogram is generic, gets its original name
707 if Present
(Parent
(E
))
708 and then Present
(Generic_Parent
(Parent
(E
)))
710 Nam
:= Chars
(Generic_Parent
(Parent
(E
)));
715 if Nam
= Name_Asm
then
718 elsif Nam
= Name_Divide
then
719 Expand_Decimal_Divide_Call
(N
);
721 elsif Nam
= Name_Exception_Information
then
722 Expand_Exception_Call
(N
, RE_Exception_Information
);
724 elsif Nam
= Name_Exception_Message
then
725 Expand_Exception_Call
(N
, RE_Exception_Message
);
727 elsif Nam
= Name_Exception_Name
then
728 Expand_Exception_Call
(N
, RE_Exception_Name_Simple
);
730 elsif Nam
= Name_Generic_Dispatching_Constructor
then
731 Expand_Dispatching_Constructor_Call
(N
);
733 elsif Nam_In
(Nam
, Name_Import_Address
,
734 Name_Import_Largest_Value
,
737 Expand_Import_Call
(N
);
739 elsif Nam
= Name_Is_Negative
then
740 Expand_Is_Negative
(N
);
742 elsif Nam
= Name_Rotate_Left
then
743 Expand_Shift
(N
, E
, N_Op_Rotate_Left
);
745 elsif Nam
= Name_Rotate_Right
then
746 Expand_Shift
(N
, E
, N_Op_Rotate_Right
);
748 elsif Nam
= Name_Shift_Left
then
749 Expand_Shift
(N
, E
, N_Op_Shift_Left
);
751 elsif Nam
= Name_Shift_Right
then
752 Expand_Shift
(N
, E
, N_Op_Shift_Right
);
754 elsif Nam
= Name_Shift_Right_Arithmetic
then
755 Expand_Shift
(N
, E
, N_Op_Shift_Right_Arithmetic
);
757 elsif Nam
= Name_Unchecked_Conversion
then
758 Expand_Unc_Conversion
(N
, E
);
760 elsif Nam
= Name_Unchecked_Deallocation
then
761 Expand_Unc_Deallocation
(N
);
763 elsif Nam
= Name_To_Address
then
764 Expand_To_Address
(N
);
766 elsif Nam
= Name_To_Pointer
then
767 Expand_To_Pointer
(N
);
769 elsif Nam_In
(Nam
, Name_File
,
771 Name_Source_Location
,
772 Name_Enclosing_Entity
,
773 Name_Compilation_ISO_Date
,
774 Name_Compilation_Date
,
775 Name_Compilation_Time
)
777 Expand_Source_Info
(N
, Nam
);
779 -- If we have a renaming, expand the call to the original operation,
780 -- which must itself be intrinsic, since renaming requires matching
781 -- conventions and this has already been checked.
783 elsif Present
(Alias
(E
)) then
784 Expand_Intrinsic_Call
(N
, Alias
(E
));
786 elsif Nkind
(N
) in N_Binary_Op
then
787 Expand_Binary_Operator_Call
(N
);
789 -- The only other case is where an external name was specified, since
790 -- this is the only way that an otherwise unrecognized name could
791 -- escape the checking in Sem_Prag. Nothing needs to be done in such
792 -- a case, since we pass such a call to the back end unchanged.
797 end Expand_Intrinsic_Call
;
799 ------------------------
800 -- Expand_Is_Negative --
801 ------------------------
803 procedure Expand_Is_Negative
(N
: Node_Id
) is
804 Loc
: constant Source_Ptr
:= Sloc
(N
);
805 Opnd
: constant Node_Id
:= Relocate_Node
(First_Actual
(N
));
809 -- We replace the function call by the following expression
811 -- if Opnd < 0.0 then
814 -- if Opnd > 0.0 then
817 -- Float_Unsigned!(Float (Opnd)) /= 0
822 Make_If_Expression
(Loc
,
823 Expressions
=> New_List
(
825 Left_Opnd
=> Duplicate_Subexpr
(Opnd
),
826 Right_Opnd
=> Make_Real_Literal
(Loc
, Ureal_0
)),
828 New_Occurrence_Of
(Standard_True
, Loc
),
830 Make_If_Expression
(Loc
,
831 Expressions
=> New_List
(
833 Left_Opnd
=> Duplicate_Subexpr_No_Checks
(Opnd
),
834 Right_Opnd
=> Make_Real_Literal
(Loc
, Ureal_0
)),
836 New_Occurrence_Of
(Standard_False
, Loc
),
841 (RTE
(RE_Float_Unsigned
),
844 Duplicate_Subexpr_No_Checks
(Opnd
))),
846 Make_Integer_Literal
(Loc
, 0)))))));
848 Analyze_And_Resolve
(N
, Standard_Boolean
);
849 end Expand_Is_Negative
;
855 -- This procedure is used to convert a call to a shift function to the
856 -- corresponding operator node. This conversion is not done by the usual
857 -- circuit for converting calls to operator functions (e.g. "+"(1,2)) to
858 -- operator nodes, because shifts are not predefined operators.
860 -- As a result, whenever a shift is used in the source program, it will
861 -- remain as a call until converted by this routine to the operator node
862 -- form which the back end is expecting to see.
864 -- Note: it is possible for the expander to generate shift operator nodes
865 -- directly, which will be analyzed in the normal manner by calling Analyze
866 -- and Resolve. Such shift operator nodes will not be seen by Expand_Shift.
868 procedure Expand_Shift
(N
: Node_Id
; E
: Entity_Id
; K
: Node_Kind
) is
869 Entyp
: constant Entity_Id
:= Etype
(E
);
870 Left
: constant Node_Id
:= First_Actual
(N
);
871 Loc
: constant Source_Ptr
:= Sloc
(N
);
872 Right
: constant Node_Id
:= Next_Actual
(Left
);
873 Ltyp
: constant Node_Id
:= Etype
(Left
);
874 Rtyp
: constant Node_Id
:= Etype
(Right
);
875 Typ
: constant Entity_Id
:= Etype
(N
);
879 Snode
:= New_Node
(K
, Loc
);
880 Set_Right_Opnd
(Snode
, Relocate_Node
(Right
));
881 Set_Chars
(Snode
, Chars
(E
));
882 Set_Etype
(Snode
, Base_Type
(Entyp
));
883 Set_Entity
(Snode
, E
);
885 if Compile_Time_Known_Value
(Type_High_Bound
(Rtyp
))
886 and then Expr_Value
(Type_High_Bound
(Rtyp
)) < Esize
(Ltyp
)
888 Set_Shift_Count_OK
(Snode
, True);
893 -- Note that we don't call Analyze and Resolve on this node, because
894 -- it already got analyzed and resolved when it was a function call.
896 Set_Left_Opnd
(Snode
, Relocate_Node
(Left
));
900 -- However, we do call the expander, so that the expansion for
901 -- rotates and shift_right_arithmetic happens if Modify_Tree_For_C
904 if Expander_Active
then
909 -- If the context type is not the type of the operator, it is an
910 -- inherited operator for a derived type. Wrap the node in a
911 -- conversion so that it is type-consistent for possible further
912 -- expansion (e.g. within a lock-free protected type).
914 Set_Left_Opnd
(Snode
,
915 Unchecked_Convert_To
(Base_Type
(Entyp
), Relocate_Node
(Left
)));
916 Rewrite
(N
, Unchecked_Convert_To
(Typ
, Snode
));
918 -- Analyze and resolve result formed by conversion to target type
920 Analyze_And_Resolve
(N
, Typ
);
924 ------------------------
925 -- Expand_Source_Info --
926 ------------------------
928 procedure Expand_Source_Info
(N
: Node_Id
; Nam
: Name_Id
) is
929 Loc
: constant Source_Ptr
:= Sloc
(N
);
933 if Nam
= Name_Line
then
935 Make_Integer_Literal
(Loc
,
936 Intval
=> UI_From_Int
(Int
(Get_Logical_Line_Number
(Loc
)))));
937 Analyze_And_Resolve
(N
, Standard_Positive
);
943 Buf
: Bounded_String
;
945 Add_Source_Info
(Buf
, Loc
, Nam
);
946 Rewrite
(N
, Make_String_Literal
(Loc
, Strval
=> +Buf
));
947 Analyze_And_Resolve
(N
, Standard_String
);
951 Set_Is_Static_Expression
(N
);
952 end Expand_Source_Info
;
954 ---------------------------
955 -- Expand_Unc_Conversion --
956 ---------------------------
958 procedure Expand_Unc_Conversion
(N
: Node_Id
; E
: Entity_Id
) is
959 Func
: constant Entity_Id
:= Entity
(Name
(N
));
965 -- Rewrite as unchecked conversion node. Note that we must convert
966 -- the operand to the formal type of the input parameter of the
967 -- function, so that the resulting N_Unchecked_Type_Conversion
968 -- call indicates the correct types for Gigi.
970 -- Right now, we only do this if a scalar type is involved. It is
971 -- not clear if it is needed in other cases. If we do attempt to
972 -- do the conversion unconditionally, it crashes 3411-018. To be
973 -- investigated further ???
975 Conv
:= Relocate_Node
(First_Actual
(N
));
976 Ftyp
:= Etype
(First_Formal
(Func
));
978 if Is_Scalar_Type
(Ftyp
) then
979 Conv
:= Convert_To
(Ftyp
, Conv
);
980 Set_Parent
(Conv
, N
);
981 Analyze_And_Resolve
(Conv
);
984 -- The instantiation of Unchecked_Conversion creates a wrapper package,
985 -- and the target type is declared as a subtype of the actual. Recover
986 -- the actual, which is the subtype indic. in the subtype declaration
987 -- for the target type. This is semantically correct, and avoids
988 -- anomalies with access subtypes. For entities, leave type as is.
990 -- We do the analysis here, because we do not want the compiler
991 -- to try to optimize or otherwise reorganize the unchecked
996 if Is_Entity_Name
(Conv
) then
999 elsif Nkind
(Parent
(Ttyp
)) = N_Subtype_Declaration
then
1000 Ttyp
:= Entity
(Subtype_Indication
(Parent
(Etype
(E
))));
1002 elsif Is_Itype
(Ttyp
) then
1004 Entity
(Subtype_Indication
(Associated_Node_For_Itype
(Ttyp
)));
1006 raise Program_Error
;
1009 Rewrite
(N
, Unchecked_Convert_To
(Ttyp
, Conv
));
1010 Set_Etype
(N
, Ttyp
);
1013 if Nkind
(N
) = N_Unchecked_Type_Conversion
then
1014 Expand_N_Unchecked_Type_Conversion
(N
);
1016 end Expand_Unc_Conversion
;
1018 -----------------------------
1019 -- Expand_Unc_Deallocation --
1020 -----------------------------
1022 procedure Expand_Unc_Deallocation
(N
: Node_Id
) is
1023 Arg
: constant Node_Id
:= First_Actual
(N
);
1024 Loc
: constant Source_Ptr
:= Sloc
(N
);
1025 Typ
: constant Entity_Id
:= Etype
(Arg
);
1026 Desig_Typ
: constant Entity_Id
:= Designated_Type
(Typ
);
1027 Needs_Fin
: constant Boolean := Needs_Finalization
(Desig_Typ
);
1028 Root_Typ
: constant Entity_Id
:= Underlying_Type
(Root_Type
(Typ
));
1029 Pool
: constant Entity_Id
:= Associated_Storage_Pool
(Root_Typ
);
1030 Stmts
: constant List_Id
:= New_List
;
1032 Arg_Known_Non_Null
: constant Boolean := Known_Non_Null
(N
);
1033 -- This captures whether we know the argument to be non-null so that
1034 -- we can avoid the test. The reason that we need to capture this is
1035 -- that we analyze some generated statements before properly attaching
1036 -- them to the tree, and that can disturb current value settings.
1038 Exceptions_OK
: constant Boolean :=
1039 not Restriction_Active
(No_Exception_Propagation
);
1041 Abrt_Blk
: Node_Id
:= Empty
;
1042 Abrt_Blk_Id
: Entity_Id
;
1047 Fin_Data
: Finalization_Exception_Data
;
1054 -- Nothing to do if we know the argument is null
1056 if Known_Null
(N
) then
1060 -- Processing for pointer to controlled types. Generate:
1062 -- Abrt : constant Boolean := ...;
1063 -- Ex : Exception_Occurrence;
1064 -- Raised : Boolean := False;
1070 -- [Deep_]Finalize (Obj_Ref);
1074 -- if not Raised then
1076 -- Save_Occurrence (Ex, Get_Current_Excep.all.all);
1079 -- Abort_Undefer_Direct;
1082 -- Depending on whether exception propagation is enabled and/or aborts
1083 -- are allowed, the generated code may lack block statements.
1087 Make_Explicit_Dereference
(Loc
,
1088 Prefix
=> Duplicate_Subexpr_No_Checks
(Arg
));
1090 -- If the designated type is tagged, the finalization call must
1091 -- dispatch because the designated type may not be the actual type
1092 -- of the object. If the type is synchronized, the deallocation
1093 -- applies to the corresponding record type.
1095 if Is_Tagged_Type
(Desig_Typ
) then
1096 if Is_Concurrent_Type
(Desig_Typ
) then
1098 Unchecked_Convert_To
1099 (Class_Wide_Type
(Corresponding_Record_Type
(Desig_Typ
)),
1102 elsif not Is_Class_Wide_Type
(Desig_Typ
) then
1104 Unchecked_Convert_To
(Class_Wide_Type
(Desig_Typ
), Obj_Ref
);
1107 -- Otherwise the designated type is untagged. Set the type of the
1108 -- dereference explicitly to force a conversion when needed given
1109 -- that [Deep_]Finalize may be inherited from a parent type.
1112 Set_Etype
(Obj_Ref
, Desig_Typ
);
1116 -- [Deep_]Finalize (Obj_Ref);
1118 Fin_Call
:= Make_Final_Call
(Obj_Ref
=> Obj_Ref
, Typ
=> Desig_Typ
);
1121 -- Abrt : constant Boolean := ...;
1122 -- Ex : Exception_Occurrence;
1123 -- Raised : Boolean := False;
1130 -- if not Raised then
1132 -- Save_Occurrence (Ex, Get_Current_Excep.all.all);
1135 if Exceptions_OK
then
1136 Build_Object_Declarations
(Fin_Data
, Stmts
, Loc
);
1139 Make_Block_Statement
(Loc
,
1140 Handled_Statement_Sequence
=>
1141 Make_Handled_Sequence_Of_Statements
(Loc
,
1142 Statements
=> New_List
(Fin_Call
),
1143 Exception_Handlers
=> New_List
(
1144 Build_Exception_Handler
(Fin_Data
))));
1146 -- Otherwise exception propagation is not allowed
1149 Fin_Blk
:= Fin_Call
;
1152 -- The finalization action must be protected by an abort defer and
1153 -- undefer pair when aborts are allowed. Generate:
1159 -- Abort_Undefer_Direct;
1162 if Abort_Allowed
then
1163 AUD
:= RTE
(RE_Abort_Undefer_Direct
);
1166 Make_Handled_Sequence_Of_Statements
(Loc
,
1167 Statements
=> New_List
(
1168 Build_Runtime_Call
(Loc
, RE_Abort_Defer
),
1170 At_End_Proc
=> New_Occurrence_Of
(AUD
, Loc
));
1173 Make_Block_Statement
(Loc
,
1174 Handled_Statement_Sequence
=> Abrt_HSS
);
1176 Add_Block_Identifier
(Abrt_Blk
, Abrt_Blk_Id
);
1177 Expand_At_End_Handler
(Abrt_HSS
, Abrt_Blk_Id
);
1179 -- Present the Abort_Undefer_Direct function to the backend so
1180 -- that it can inline the call to the function.
1182 Add_Inlined_Body
(AUD
, N
);
1184 -- Otherwise aborts are not allowed
1187 Abrt_Blk
:= Fin_Blk
;
1190 Append_To
(Stmts
, Abrt_Blk
);
1193 -- For a task type, call Free_Task before freeing the ATCB. We used to
1194 -- detect the case of Abort followed by a Free here, because the Free
1195 -- wouldn't actually free if it happens before the aborted task actually
1196 -- terminates. The warning was removed, because Free now works properly
1197 -- (the task will be freed once it terminates).
1199 if Is_Task_Type
(Desig_Typ
) then
1201 Cleanup_Task
(N
, Duplicate_Subexpr_No_Checks
(Arg
)));
1203 -- For composite types that contain tasks, recurse over the structure
1204 -- to build the selectors for the task subcomponents.
1206 elsif Has_Task
(Desig_Typ
) then
1207 if Is_Array_Type
(Desig_Typ
) then
1208 Append_List_To
(Stmts
, Cleanup_Array
(N
, Arg
, Desig_Typ
));
1210 elsif Is_Record_Type
(Desig_Typ
) then
1211 Append_List_To
(Stmts
, Cleanup_Record
(N
, Arg
, Desig_Typ
));
1215 -- Same for simple protected types. Eventually call Finalize_Protection
1216 -- before freeing the PO for each protected component.
1218 if Is_Simple_Protected_Type
(Desig_Typ
) then
1220 Cleanup_Protected_Object
(N
, Duplicate_Subexpr_No_Checks
(Arg
)));
1222 elsif Has_Simple_Protected_Object
(Desig_Typ
) then
1223 if Is_Array_Type
(Desig_Typ
) then
1224 Append_List_To
(Stmts
, Cleanup_Array
(N
, Arg
, Desig_Typ
));
1226 elsif Is_Record_Type
(Desig_Typ
) then
1227 Append_List_To
(Stmts
, Cleanup_Record
(N
, Arg
, Desig_Typ
));
1231 -- Normal processing for non-controlled types. The argument to free is
1232 -- a renaming rather than a constant to ensure that the original context
1233 -- is always set to null after the deallocation takes place.
1235 Free_Arg
:= Duplicate_Subexpr_No_Checks
(Arg
, Renaming_Req
=> True);
1236 Free_Nod
:= Make_Free_Statement
(Loc
, Empty
);
1237 Append_To
(Stmts
, Free_Nod
);
1238 Set_Storage_Pool
(Free_Nod
, Pool
);
1240 -- Attach to tree before analysis of generated subtypes below
1242 Set_Parent
(Stmts
, Parent
(N
));
1244 -- Deal with storage pool
1246 if Present
(Pool
) then
1248 -- Freeing the secondary stack is meaningless
1250 if Is_RTE
(Pool
, RE_SS_Pool
) then
1253 -- If the pool object is of a simple storage pool type, then attempt
1254 -- to locate the type's Deallocate procedure, if any, and set the
1255 -- free operation's procedure to call. If the type doesn't have a
1256 -- Deallocate (which is allowed), then the actual will simply be set
1260 (Get_Rep_Pragma
(Etype
(Pool
), Name_Simple_Storage_Pool_Type
))
1263 Pool_Typ
: constant Entity_Id
:= Base_Type
(Etype
(Pool
));
1264 Dealloc
: Entity_Id
;
1267 Dealloc
:= Get_Name_Entity_Id
(Name_Deallocate
);
1268 while Present
(Dealloc
) loop
1269 if Scope
(Dealloc
) = Scope
(Pool_Typ
)
1270 and then Present
(First_Formal
(Dealloc
))
1271 and then Etype
(First_Formal
(Dealloc
)) = Pool_Typ
1273 Set_Procedure_To_Call
(Free_Nod
, Dealloc
);
1276 Dealloc
:= Homonym
(Dealloc
);
1281 -- Case of a class-wide pool type: make a dispatching call to
1282 -- Deallocate through the class-wide Deallocate_Any.
1284 elsif Is_Class_Wide_Type
(Etype
(Pool
)) then
1285 Set_Procedure_To_Call
(Free_Nod
, RTE
(RE_Deallocate_Any
));
1287 -- Case of a specific pool type: make a statically bound call
1290 Set_Procedure_To_Call
1291 (Free_Nod
, Find_Prim_Op
(Etype
(Pool
), Name_Deallocate
));
1295 if Present
(Procedure_To_Call
(Free_Nod
)) then
1297 -- For all cases of a Deallocate call, the back-end needs to be able
1298 -- to compute the size of the object being freed. This may require
1299 -- some adjustments for objects of dynamic size.
1301 -- If the type is class wide, we generate an implicit type with the
1302 -- right dynamic size, so that the deallocate call gets the right
1303 -- size parameter computed by GIGI. Same for an access to
1304 -- unconstrained packed array.
1306 if Is_Class_Wide_Type
(Desig_Typ
)
1308 (Is_Array_Type
(Desig_Typ
)
1309 and then not Is_Constrained
(Desig_Typ
)
1310 and then Is_Packed
(Desig_Typ
))
1313 Deref
: constant Node_Id
:=
1314 Make_Explicit_Dereference
(Loc
,
1315 Duplicate_Subexpr_No_Checks
(Arg
));
1320 -- Perform minor decoration as it is needed by the side effect
1321 -- removal mechanism.
1323 Set_Etype
(Deref
, Desig_Typ
);
1324 Set_Parent
(Deref
, Free_Nod
);
1325 D_Subtyp
:= Make_Subtype_From_Expr
(Deref
, Desig_Typ
);
1327 if Nkind
(D_Subtyp
) in N_Has_Entity
then
1328 D_Type
:= Entity
(D_Subtyp
);
1331 D_Type
:= Make_Temporary
(Loc
, 'A');
1332 Insert_Action
(Deref
,
1333 Make_Subtype_Declaration
(Loc
,
1334 Defining_Identifier
=> D_Type
,
1335 Subtype_Indication
=> D_Subtyp
));
1338 -- Force freezing at the point of the dereference. For the
1339 -- class wide case, this avoids having the subtype frozen
1340 -- before the equivalent type.
1342 Freeze_Itype
(D_Type
, Deref
);
1344 Set_Actual_Designated_Subtype
(Free_Nod
, D_Type
);
1349 -- Ada 2005 (AI-251): In case of abstract interface type we must
1350 -- displace the pointer to reference the base of the object to
1351 -- deallocate its memory, unless we're targetting a VM, in which case
1352 -- no special processing is required.
1355 -- free (Base_Address (Obj_Ptr))
1357 if Is_Interface
(Directly_Designated_Type
(Typ
))
1358 and then Tagged_Type_Expansion
1360 Set_Expression
(Free_Nod
,
1361 Unchecked_Convert_To
(Typ
,
1362 Make_Function_Call
(Loc
,
1364 New_Occurrence_Of
(RTE
(RE_Base_Address
), Loc
),
1365 Parameter_Associations
=> New_List
(
1366 Unchecked_Convert_To
(RTE
(RE_Address
), Free_Arg
)))));
1372 Set_Expression
(Free_Nod
, Free_Arg
);
1375 -- Only remaining step is to set result to null, or generate a raise of
1376 -- Constraint_Error if the target object is "not null".
1378 if Can_Never_Be_Null
(Etype
(Arg
)) then
1380 Make_Raise_Constraint_Error
(Loc
,
1381 Reason
=> CE_Access_Check_Failed
));
1385 Lhs
: constant Node_Id
:= Duplicate_Subexpr_No_Checks
(Arg
);
1387 Set_Assignment_OK
(Lhs
);
1389 Make_Assignment_Statement
(Loc
,
1391 Expression
=> Make_Null
(Loc
)));
1395 -- Generate a test of whether any earlier finalization raised an
1396 -- exception, and in that case raise Program_Error with the previous
1397 -- exception occurrence.
1400 -- if Raised and then not Abrt then
1401 -- raise Program_Error; -- for restricted RTS
1403 -- Raise_From_Controlled_Operation (E); -- all other cases
1406 if Needs_Fin
and then Exceptions_OK
then
1407 Append_To
(Stmts
, Build_Raise_Statement
(Fin_Data
));
1410 -- If we know the argument is non-null, then make a block statement
1411 -- that contains the required statements, no need for a test.
1413 if Arg_Known_Non_Null
then
1415 Make_Block_Statement
(Loc
,
1416 Handled_Statement_Sequence
=>
1417 Make_Handled_Sequence_Of_Statements
(Loc
,
1418 Statements
=> Stmts
));
1420 -- If the argument may be null, wrap the statements inside an IF that
1421 -- does an explicit test to exclude the null case.
1425 Make_Implicit_If_Statement
(N
,
1428 Left_Opnd
=> Duplicate_Subexpr
(Arg
),
1429 Right_Opnd
=> Make_Null
(Loc
)),
1430 Then_Statements
=> Stmts
);
1435 Rewrite
(N
, Gen_Code
);
1437 end Expand_Unc_Deallocation
;
1439 -----------------------
1440 -- Expand_To_Address --
1441 -----------------------
1443 procedure Expand_To_Address
(N
: Node_Id
) is
1444 Loc
: constant Source_Ptr
:= Sloc
(N
);
1445 Arg
: constant Node_Id
:= First_Actual
(N
);
1449 Remove_Side_Effects
(Arg
);
1451 Obj
:= Make_Explicit_Dereference
(Loc
, Relocate_Node
(Arg
));
1454 Make_If_Expression
(Loc
,
1455 Expressions
=> New_List
(
1457 Left_Opnd
=> New_Copy_Tree
(Arg
),
1458 Right_Opnd
=> Make_Null
(Loc
)),
1459 New_Occurrence_Of
(RTE
(RE_Null_Address
), Loc
),
1460 Make_Attribute_Reference
(Loc
,
1462 Attribute_Name
=> Name_Address
))));
1464 Analyze_And_Resolve
(N
, RTE
(RE_Address
));
1465 end Expand_To_Address
;
1467 -----------------------
1468 -- Expand_To_Pointer --
1469 -----------------------
1471 procedure Expand_To_Pointer
(N
: Node_Id
) is
1472 Arg
: constant Node_Id
:= First_Actual
(N
);
1475 Rewrite
(N
, Unchecked_Convert_To
(Etype
(N
), Arg
));
1477 end Expand_To_Pointer
;