ada: Fix unnesting generated loops with nested finalization procedure The compiler can generate loops for creating array aggregates, for example used during the initialization of variable. If the component type of the array element requires finalization, the compiler also creates a block and a nested procedure that need to be correctly unnested if unnesting is enabled. During the unnesting transformation, the scopes for these inner blocks need to be fixed and set to the enclosing loop entity. gcc/ada/ * exp_ch7.adb (Contains_Subprogram): Recursively search for subp in loop's statements. (Unnest_Loop)<Fixup_Inner_Scopes>: New. (Unnest_Loop): Rename local variable for more clarity. * exp_unst.ads: Refresh comment.
Before yesterdayChange logs
ada: Refine upper array bound for bit packed array When using bit-packed arrays, the compiler creates new array subtypes of 1-bit component indexed by integers. The existing routine checks the index subtype to find the min/max values. Bit-packed arrays being indexed by integers, the routines gives up as returning the maximum possible integer carries no useful information. This change adds a simple max_value routine that can evaluate very simple expressions by substituting variables by their min/max value. Bit-packed array subtypes are currently declared as: subtype bp_array is packed_bytes1 (0 .. integer((1 * Var + 7) / 8 - 1)); The simple max_value evaluator handles the bare minimum for this expression pattern. gcc/ada/ChangeLog: * gcc-interface/utils.cc (max_value): New. * gcc-interface/gigi.h (max_value): New. * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Subtype>: When computing gnu_min/gnu_max, try to use max_value if there is an initial expression.