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 change fixes a compiler crash occurring in some cases of constant declarations initialized with a call to an instance of a generic function, when the returned type is an array of dynamically sized elements. The following compilation must be accepted quietly: $ gcc -c p.adb package Q is function F return Integer; subtype Comp is String (1 .. F); type Element_T is record C : Comp; end record; end Q; with Q; procedure P is type Exist_Element_T (Exist : Boolean := False) is record case Exist is when True => Value : Q.Element_T; when False => null; end case; end record; type Arr is array (Boolean) of Exist_Element_T; generic type Idx is (<>); type Elmt is private; type Arr is array (Idx) of Elmt; function F_G return Arr; function F_G return Arr is A : Elmt; begin return Arr'(others => A); end F_G; function F is new F_G (Idx => Boolean, Elmt => Exist_Element_T, Arr => Arr); Const_Arr : constant Arr := F; begin null; end; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-22 Thomas Quinot <quinot@adacore.com> * sem_ch3.adb (Analyze_Object_Declaration): For a constant declaration initialized with a function call, whose type has variable size, need to remove side effects so that the initialization expression becomes a dereference of a temporary reference to the function result.
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] |