Before yesterdayChange logs
ada: Compiler crash on container aggregate with loop_parameter_specifications The compiler crashes on a container aggregate with more than one iterated_element_association given by a loop_parameter_specification. In such a case, the tree contains N_Iterated_Component_Association nodes rather than N_Iterated_Element_Association nodes, and the code for handling those needs to obtain the bounds from the Discrete_Choices field of each N_Iterated_Component_Association rather than assuming that the association has a normal list of choices. gcc/ada/ * sem_aggr.adb (Resolve_Container_Aggregate): In the case where Comp is an N_Iterated_Component_Association, pick up Discrete_Choices rather than Choices.
ada: Another couple of cleanups in the finalization machinery For package specs and bodies that need finalizers, Build_Finalizer is invoked from the Standard scope so it needs to adjust the scope stack before creating new objects; this changes it to do so only once. For other kinds of scopes, it is invoked from Expand_Cleanup_Actions, which assumes that the correct scope is already on the stack; that's why Cleanup_Scopes adjusts the scope stack explicitly, but it should use Pop_Scope instead of End_Scope to do it. gcc/ada/ * exp_ch7.adb (Build_Finalizer): For package specs and bodies, push and pop the specs onto the scope stack only once. * inline.adb (Cleanup_Scopes): Call Pop_Scope instead of End_Scope.
ada: Deep delta aggregates in postconditions Fix a bug in handling array-valued deep delta aggregates occurring in postconditions. The bug could result in a spurious compilation failure. gcc/ada/ * sem_aggr.adb (Resolve_Delta_Array_Aggregate): In the case of a deep delta choice, the expected type for the expression will typically not be the component type of the array type, so a call to Analyze_And_Resolve that assumes otherwise would be an error. It turns out that such a call, while wrong, is usually harmless because the expression has already been marked as analyzed. This doesn't work if the aggregate occurs in a postcondition and, in any case, we don't want to rely on this. So do not perform the call in the deep case.
ada: Compiler error reporting illegal prefix on legal loop iterator with "in" During semantic analysis, the compiler fails to determine the cursor type in the case of a generalized iterator loop with "in", in the case where the iterator type has a parent type that is a controlled type (for example) and its ancestor iterator interface type is given after as a progenitor. It also improperly determines the ancestor interface type during expansion (within Expand_Iterator_Loop_Over_Container), for both "in" and "of" iterator forms. The FE was assuming that the iterator interface is simply the parent type of the iterator type, but that type can occur later in the interface list, or be inherited. A new function is added that properly locates a type's iterator interface ancestor, if any, and is called for analysis and expansion. gcc/ada/ * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): Retrieve the iteration type's iteration interface progenitor via Iterator_Interface_Ancestor, in the case of both "in" and "of" iterators. Narrow the scope of Pack, so it's declared and initialized only within the code related to "of" iterators, and change its name to Cont_Type_Pack. Adjust comments. * sem_ch5.adb (Get_Cursor_Type): In the case of a derived type, retrieve the iteration type's iterator interface progenitor (if it exists) via Iterator_Interface_Ancestor rather than assuming that the parent type is the interface progenitor. * sem_util.ads (Iterator_Interface_Ancestor): New function. * sem_util.adb (Iterator_Interface_Ancestor): New function returning a type's associated iterator interface type, if any, by collecting and traversing the type's interfaces.
ada: Small consistency fix for -gnatwv warning The goal is to arrange for the warning to be issued consistently between objects whose address is taken and objects whose address is not taken. gcc/ada/ * sem_warn.adb (Check_References.Type_OK_For_No_Value_Assigned): New predicate. (Check_References): For Warn_On_No_Value_Assigned, use the same test on the type in the address-not-taken and default cases. gcc/testsuite/ChangeLog: * gnat.dg/warn25.adb: Add xfail.
ada: Fix internal error on 'Address of task component This happens when the prefix of the selected component is of an access type, i.e. there is an implicit dereference. because the prefix is not resolved. gcc/ada/ * sem_attr.adb (Resolve_Attribute) <Attribute_Address>: Remove the bypass for prefixes with task type.
ada: Further cleanup in finalization machinery The bodies of generic units are instantiated separately by GNAT at the end of the processing of the compilation unit. This requires the deferral of the generation of cleanups and finalization actions in enclosing scopes, except for instantiations in generic units where they are not generated. The criterion used to detect this latter case is Inside_A_Generic, but this global variable is not properly updated during the instantiation of generic bodies, leading to problems with nested instantiations, so it is changed to Expander_Active instead. As a matter of fact, the exact same idiom is used a few lines above to clear the Needs_Body variable. gcc/ada/ * sem_ch12.adb (Analyze_Package_Instantiation): Test Expander_Active to detect generic contexts for the generation of cleanup actions.
ada: Fix string indexing within GNAT.Calendar.Time_IO.Value The patch fixes an issue in the compiler whereby calls to GNAT.Calendar.Time_IO.Value where the actual for formal String Date with indexing starting at any value besides one would result in a spurious runtime exception. gcc/ada/ * libgnat/g-catiio.adb (Value): Modify conditionals to use 'Last instead of 'Length
ada: Further cleanup in finalization machinery This removes the specific treatment of transient scopes in initialization procedures, which is obsolete. gcc/ada/ * exp_aggr.adb (Convert_To_Assignments): Do not treat initialization procedures specially when it comes to creating a transient scope. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Likewise. * exp_util.adb (Requires_Cleanup_Actions): Likewise.
ada: Small cleanup in finalization machinery This removes an obsolete flag and adjusts a couple of obsolete comments. gcc/ada/ * gen_il-fields.ads (Opt_Field_Enum): Remove Is_Finalization_Wrapper * gen_il-gen-gen_nodes.adb (N_Block_Statement): Likewise. * sinfo.ads (Is_Finalization_Wrapper): Delete. * exp_ch7.adb (Build_Finalizer.Process_Declarations): Adjust comment and remove obsolete code testing the Is_Finalization_Wrapper flag. * exp_util.adb (Requires_Cleanup_Actions): Likewise.
ada: Fix Ada.Text_IO.Delete with "encoding=8bits" form Before this patch, on Windows, file with non-ASCII Latin1 names could be created with Ada.Text_IO.Create by passing "encoding=8bits" through the Form parameter and a Latin1-encoded string through the Name parameter, but calling Ada.Text_IO.Delete on them raised an illegitimate exception. This patch fixes this by making the wrappers of the unlink system function aware of the encoding value passed through the Form parameter. It also removes an unnecessary curly-brace block. gcc/ada/ * adaint.c (__gnat_unlink): Add new parameter and fix text conversion on Windows. Remove unnecessary curly braces. * adaint.h (__gnat_unlink): Add new parameter. * libgnat/i-cstrea.ads (unlink): Adapt to __gnat_unlink signature change. * libgnat/i-cstrea.adb (unlink): New Subprogram definition. * libgnat/s-crtl.ads (unlink): Adapt to __gnat_unlink signature change. * libgnat/s-fileio.adb (Delete): Pass encoding argument to unlink.
ada: Fix issue with indefinite vector of overaligned unconstrained array The problem is that the aligning machinery is not consistently triggered, depending on whether a constrained view or the nominal unconstrained view of the element type is used to perform the allocations and deallocations. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Subtype>: Put the alignment directly on the type in the constrained case too. * gcc-interface/utils.cc (maybe_pad_type): For an array type, take the alignment of the element type as the original alignment.