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] | |
Tested on i686-linux, committed on trunk
When we generate static dispatch tables for library-level tagged types, we
create global constants to be used in import/export statements to make the
dispatch tables visible to the back-end. The code did not take into account
package bodies nested within the declarations of a library level package body,
nor the proper body of a package body stub appearing in the same context. This
led to undefined symbols at link time.
---
This patch also adds a missing check to avoid wrong management of renamed
primitives during the assignment of the dispatch table slots.
gnat.dg/dispatch2.adb now compiles and executes without errors.
--
Finally, provide better error message for incomplete type in backend.
The detection of premature freezing that follows AI05-019 is extended to Ada95.
The rule fixes a gap in the Ada95 RM, and corrects the description given in
13.14 (14) in the Ada 2005 RM. In all cases the fix consists in moving an
object declaration past the full declaration of some untagged private type.
Compiling p,adb must be rejected with the message:
p.ads:11:03: declaration must appear after completion of type "T2"
p.ads:11:03: which is an untagged type in the profile of
primitive operation "Retrieve" declared at line 5
package P is
type T1 is tagged private;
type T2 is private;
function Retrieve (From : T1) return T2;
private
type T1 is tagged record
Value : Integer;
end record;
Thing1 : T1;
type T2 is new integer;
end;
package body P is
procedure Dispatch (On : T1) is
begin
if Retrieve (On) < 5 then
null;
end if;
end Dispatch;
function Retrieve (From : T1) return T2 is
begin
return T2 (From.Value);
end;
end P;
2007-08-14 Ed Schonberg <schonberg@adacore.com>
Javier Miranda <miranda@adacore.com>
* exp_disp.ads, exp_disp.adb (Build_Dispatch_Tables): Handle tagged
types declared in the declarative part of a nested package body or in
the proper body of a stub.
(Set_All_DT_Position): Add missing check to avoid wrong assignation
of the same dispatch table slot to renamed primitives.
(Make_Select_Specific_Data_Table): Handle private types.
(Tagged_Kind): Handle private types.
(Make_Tags, Make_DT): Set tag entity as internal to ensure proper dg
output of implicit importation and exportation.
(Expand_Interface_Thunk): Fix bug in the expansion assuming that the
first formal of the thunk is always associated with the controlling
type. In addition perform the following code cleanup: remove formal
Thunk_Alias which is no longer required, cleanup evaluation of the
the controlling type, and update the documentation.
Replace occurrence of Default_Prim_Op_Count by
Max_Predef_Prims. Addition of compile-time check to verify
that the value of Max_Predef_Prims is correct.
(Check_Premature_Freezing): Apply check in Ada95 mode as well.
(Make_DT): Add parameter to indicate when type has been frozen by an
object declaration, for diagnostic purposes.
(Build_Static_Dispatch_Tables): New subprogram that takes care of the
construction of statically allocated dispatch tables.
(Make_DT): In case of library-level tagged types export the declaration
of the primary tag. Remove generation of tags (now done by Make_Tags).
Additional modifications to handle non-static generation of dispatch
tables. Take care of building tables for asynchronous interface types
(Make_Tags): New subprogram that generates the entities associated with
the primary and secondary tags of Typ and fills the contents of Access_
Disp_Table. In case of library-level tagged types imports the forward
declaration of the primary tag that will be declared later by Make_DT.
(Expand_Interface_Conversion): In case of access types to interfaces
replace an itype declaration by an explicit type declaration to avoid
problems associated with the scope of such itype in transient blocks.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |