ada: Assertion failure on calculation of Large_Max_Size_Mutable
28 August 2023 at 19:14
ada: Fix late finalization for function call in delta aggregate The problem occurs at library level because the temporary created for the function call lives in the elaboration routine but is finalized only when the package itself is. It turns out that there is no need for this temporary, since the expansion of delta aggregates already creates a (properly finalized) temporary. gcc/ada/ * exp_ch6.adb (Expand_Ctrl_Function_Call): Also do nothing for the expression of a delta aggregate.
ada: Fix premature finalization in loop over limited iterable container This happens when the iterable container is obtained as the result of a call to a function that is a subprogram parameter of a generic construct. gcc/ada/ * exp_util.adb (Initialized_By_Aliased_BIP_Func_Call): Make the name matching more robust.
ada: Improve detection of deactivated code for warnings with -gnatwt Switch -gnatwt is used in GNAT to track deleted code. It can be emitted by GNAT on code that is intentionally deactivated for a given configuration. The current test to suppress spurious warnings is not complex enough to detect all such cases. Now improved, by using the same test as used in GNATprove to suppress warnings related to a "statically disabled condition which evaluates to a given value", as described in SPARK UG 7.3.2. gcc/ada/ * exp_util.adb (Is_Statically_Disabled): New function to detect a "statically disabled condition which evaluates to a given value", as described in SPARK UG 7.3.2. (Kill_Dead_Code): Call the new function Is_Statically_Disabled for conditions of if statements. * exp_util.ads (Is_Statically_Disabled): New function spec.
ada: Fix problematic secondary stack management in protected entry The secondary stack mark goes formally out of scope before the finalizer reads it to reclaim the storage. gcc/ada/ * exp_ch9.adb (Build_Protected_Entry): Move the At_End procedure from the entry body to the inner block statement.
ada: Remove redundant protection against empty list Calls to First on No_List intentionally return Empty, so explicit guards against No_List are unnecessary. Code cleanup; semantics is unaffected. gcc/ada/ * sem_type.adb (Interface_Present_In_Ancestor): Remove guard against no list of interfaces; fix style in comments (trailing dots).
ada: Add guard before querying the type for its interfaces Fix crash on illegal code, when routine Iface_Present_In_Ancestor is called on the predefined String type and attempts to examine the list of interfaces. gcc/ada/ * sem_type.adb (Iface_Present_In_Ancestor): Only look at the list of interfaces for types that allow it. The guard is a high-level equivalent of the entity kinds listed in the preconditon of the Interfaces query.
ada: Fix crash on selected component lookup in generic instance This patch fixes a compiler crash on selected component lookup in an instance of a generic unit when the relevant type is an itype. gcc/ada/ * sem_ch4.adb (Find_Component_In_Instance): Check that Declaration_Node (Par) is not Empty, as it is for itypes.
ada: Fix DWARF for certain arrays An array whose index type is a nonstandard enum will be marked as "packed", but should not emit DW_AT_bit_stride unless it is also bit-packed. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Set bit-packed for constrained and unconstrained array types. * gcc-interface/misc.cc (gnat_get_array_descr_info): Examine BIT_PACKED_ARRAY_TYPE_P.
ada: Fix assertion failure on very peculiar enumeration type The compiler currently does not support the combination of a representation clause on an enumeration type with a size clause whose value is greater than the size of the largest machine scalar supported by the target. Given that such a type would have little practical value, this change causes the compiler to give a proper error message instead of aborting. gcc/ada/ * freeze.adb (Freeze_Enumeration_Type): Give an error on a type with both representation clause and too large size.
ada: Fix spurious warning emissions Before this patch, warnings handled by `Sem_Warn.Check_References` were erroneously emitted in some cases. Here is an example of a program that, when compiled with the `-gnatwu` switch, triggered the bug: procedure Main is package T is A : Integer; end T; begin T.A := 7; end Main; The following message was emitted: main.adb:3:07: warning: variable "A" is never read and never assigned [-gnatwu] This patch mitigates the issue by restricting the cases in which `Sem_Warn.Check_References` is called for package specifications. Note that the recursive calls in `Sem_Warn.Check_References` can be used to convince oneself that this patch does not remove legitimate warnings for non-library-level package specifications. gcc/ada/ * sem_ch7.adb (Analyze_Package_Declaration): Restrict calls to `Sem_Warn.Check_References` and adjust comment accordingly.
ada: Crash on creation of extra formals on type extension The compiler blows up processing an overriding dispatching function of a derived tagged type that returns a private tagged type that has an access type discriminant. gcc/ada/ * accessibility.ads (Needs_Result_Accessibility_Extra_Formal): New subprogram. * accessibility.adb (Needs_Result_Accessibility_Level_Param): New subprogram. (Needs_Result_Accessibility_Extra_Formal): New subprogram, temporarily keep the previous behavior of the frontend. * sem_ch6.adb (Create_Extra_Formals): Replace occurrences of function Needs_Result_Accessibility_Level_Param by calls to function Needs_Result_Accessibility_Extra_Formal. (Extra_Formals_OK): Ditto.
ada: Crash on function returning empty Ada 2022 aggregate The compiler crashes processing a function that returns an empty aggregate when its returned type is a record type which defined its container aggregate aspects. gcc/ada/ * exp_aggr.adb (Expand_Container_Aggregate): Report warning on infinite recursion if an empty container aggregate appears in the return statement of its Empty function. Fix typo in comment. * sem_aggr.adb (Resolve_Aggregate): Resolve Ada 2022 empty aggregate that initializes a record type that has defined its container aggregate aspects. (Resolve_Iterated_Association): Protect access to attribute Etype. * sem_ch13.adb (Resolve_Aspect_Aggregate): Fix typo in comment.