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 mainline. This was a set of problems with generation of size functions by the front end's type layout algorithms (currently only used by the non-GCC-based GNAAMP compiler). The initial symptom was an assertion failure in Install_Visible_Decls, which was being passed a private type. The idiom causing this was a private type whose full type contained a discriminant- dependent array component). The fix for that specific blowup was to check Underlying_Type of an array's parent scope when determining the insertion type in Layout_Array_Type. The assertion failure turned out to be masking a more fundamental problem, namely that the V formals in various size functions generated for a discriminated private type were being given inconsistent type views (private vs. full entity). That resulted in type mismatches when analyzing certain size functions, depending on when the type was frozen. The following test should compile silently with -gnatdF -gnatws -gnatc: -- procedure FE_Layout_Bugs is subtype Subint is Integer range 0 .. 100; package Pkg is type Rec (D : Subint := 10) is private; private type Rec (D : Subint := 10) is record S : String (1 .. D); end record; end Pkg; R1 : Pkg.Rec; -- Assert_Failure with GNAAMP (or with FE layout on) R2 : Pkg.Rec (10); -- Causes type mismatch errors after fix for A_F R3 : Pkg.Rec (7); package body Pkg is P1 : Pkg.Rec (10); P2 : Pkg.Rec; end Pkg; begin null; end FE_Layout_Bugs; 2005-06-14 Gary Dismukes <dismukes@adacore.com> * layout.adb (Discrimify): Remove resetting of Vtype to the underlying type which turns out to be an incomplete and incorrect fix. (Layout_Array_Type): Use Underlying_Type when checking whether the scope of the type is declared in a record (for determination of insertion type). (SO_Ref_From_Expr): Test whether Vtype denotes a partial or full view of a private type and ensure that the primary entity is used for the type of the newly created function's V formal by taking the Etype of the view.
Attachment:
difs.33
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |