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]

[Ada] fix default init with aggregate


Tested on i686-linux, committed on trunk

When the default values of all components of a record are static, we create
an aggregate with static components, and use it to initialize objects of the
type, rather than calling the generated initialization procedure for the type.
If the components of the aggregate are themselves array aggregates, they may
generate itypes for index and array subtypes. Given that itypes are elaborated
on demand, their first use is upon the first declaration of an object of the
type. If this declaration is nested within the scope that declares the type,
this will lead to a back-end error. To prevent this, we collect all itypes
present in the aggregate, and introduce references to them at the point where
the type itself is frozen.

See gnat.dg/aggr8.adb

2007-08-31  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch3.adb (Build_Record_Init_Proc): If there is a static
	initialization aggregate for the type, generate itype references for
	thetypes of its (sub)components, to prevent out-of-scope errors in gigi.

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]