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] |
This fixes an internal error in the gimplifier when it is trying to generate code for a CONSTRUCTOR of a record type with a component whose type contains a variant part. The handling of this kind of CONSTRUCTORs is delicate and the front-end has a special circuitry to pre-decompose them (or rather aggregates, as they are called in Ada) into assignments. This circuitry was recently adjusted to be less conservative, so as to let the back-end build fully static objects in more cases. However, when they cannot be built statically because they contain non-static parts, aggregates of this sort need always be pre-decomposed. The change makes sure this is the case. But, in order not to go back too far on the conservative side, it also enhances the circuitry that computes whether an aggregate can be built statically or not. The following code must compile quietly: with Aggr4_Pkg; use Aggr4_Pkg; package Aggr4 is C : constant Rec3 := (Data => (D => One, Value => Zero)); end Aggr4; package Aggr4_Pkg is function F return Integer; type Rec1 is tagged record I : Integer; end record; Zero : constant Rec1 := (I => F); type Enum is (One, Two); type Rec2 (D : Enum := One) is record case D is when One => Value : Rec1; when others => null; end case; end record; type Rec3 is record Data : Rec2; end record; end Aggr4_Pkg; Tested on x86_64-pc-linux-gnu, committed on trunk 2012-02-08 Eric Botcazou <ebotcazou@adacore.com> * exp_aggr.adb (Compile_Time_Known_Composite_Value): New predicate to compute whether a composite value can be evaluated at compile time. (Component_Not_OK_For_Backend): Use Compile_Time_Known_Value for all expressions of elementary type and Compile_Time_Known_Composite_Value for all other expressions. (Expand_Record_Aggregate): Convert to assignments in the case of a type with mutable components if the aggregate cannot be built statically.
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] |