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] Initializing packed arrays when Initialize_Scalars is enabled.


Tested on i686-linux, committed on trunk

When Initialize_Scalars is requested, scalar variables that have no explicit
initialization are given out-of-range values so that their use is caught at
run-time. The initialization procedure for a packed array uses the default
(out-of-range) value for the component type to initialize each array component.
The component assignment must be compiled without constraint checks, lest a
call to initialize an array object raise constraint-error immiediately (rather
than setting the components to out-of-range values as desired).

See gnat.dg/init_scalar1.adb

2008-03-26  Ed Schonberg  <schonberg@adacore.com>

	* exp_pakd.adb (Expand_Bit_Packed_Element_Set): If the component
	assignment is within the initialization procedure for a packed array,
	and Initialize_Scalars is enabled, compile right-hand side with checks
	off, because the value is purposely out of range.

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]