โŒ About FreshRSS

Reading view

There are new articles available, click to refresh the page.

ada: Fix internal error on instantiation with private component type

ada: Fix internal error on instantiation with private component type

First, this fixes an internal error on the instantiation of a nested generic
package taking an array type whose component type is a private type declared
in the parent package as formal type parameter. In the body of the instance,
the full view of the private type is visible and must be restored by means
of the Check_Generic_Actuals mechanism.

Second, this fixes the same internal error in the case where the component
type itself is an array type whose component type is a private type declared
in the parent package, i.e. when the formal type parameter is an array of
array type, by naturally extending the Has_Secondary_Private_View mechanism
to the array of array case.

gcc/ada/

	* sem_ch12.adb (Component_Type_For_Private_View): New function.
	(Check_Generic_Actuals): For an actual type parameter, also check
	its component type if it is an array type.
	(Check_Private_View): Use Component_Type_For_Private_View in the
	case of an array type.
	(Instantiate_Type): Likewise.
	(Save_Global_References.Set_Global_Type): Likewise.
  • [DBH] gcc/ada/sem_ch12.adb

ada: Fix assertion failure on very peculiar enumeration type

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.
  • [DBH] gcc/ada/freeze.adb

ada: Fix late finalization for function call in delta aggregate

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.
  • [DBH] gcc/ada/exp_ch6.adb

ada: Fix internal error on expression function with Refined_Post aspect

ada: Fix internal error on expression function with Refined_Post aspect

This occurs when the expression function calls a protected function and the
-gnata switch is specified, because the compiler wrongly freezes the called
function when analyzing the expression function, a fallout of the wrapping
scheme used for the Post and Refined_Post aspects.

gcc/ada/

	* sem_res.adb (Resolve_Call): When the target is an entity, do not
	freeze it if the current scope is the inner wrapper function built
	for an expression function with a Post or Refined_Post aspect.
  • [DBH] gcc/ada/sem_res.adb

ada: Fix wrong optimization of extended return for discriminated record type

ada: Fix wrong optimization of extended return for discriminated record type

This happens when the discriminants of the record type have default values.

gcc/ada/ChangeLog:

	* inline.adb (Expand_Inlined_Call): In the case of a function call
	that returns an unconstrained type and initializes an object, set
	the No_Initialization flag on the new declaration of the object.
  • [DBH] gcc/ada/inline.adb

ada: Fix missing finalization of extended return object on abnormal completion

ada: Fix missing finalization of extended return object on abnormal completion

This happens in the case of a nonlimited return type and is a fallout of the
optimization recently implemented for them.

gcc/ada/

	* einfo.ads (Status_Flag_Or_Transient_Decl): Remove ??? comment.
	* exp_ch6.adb (Expand_N_Extended_Return_Statement): Extend the
	handling of finalizable return objects to the non-BIP case.
	* exp_ch7.adb (Build_Finalizer.Process_Declarations): Adjust the
	comment accordingly.
	* exp_util.adb (Requires_Cleanup_Actions): Likewise.
  • [DBH] gcc/ada/einfo.ads
  • [DBH] gcc/ada/exp_ch6.adb
  • [DBH] gcc/ada/exp_ch7.adb
  • [DBH] gcc/ada/exp_util.adb

ada: Fix deferred constant wrongly rejected

ada: Fix deferred constant wrongly rejected

This recent regression occurs when the nominal subtype of the constant is a
discriminated record type with default discriminants.

gcc/ada/
	PR ada/110488
	* sem_ch3.adb (Analyze_Object_Declaration): Do not build a default
	subtype for a deferred constant in the definite case too.
  • [DBH] gcc/ada/sem_ch3.adb

ada: Fix missing call to Finalize_Protection for simple protected objects

ada: Fix missing call to Finalize_Protection for simple protected objects

There is a glitch in Exp_Ch7.Build_Finalizer causing the finalizer to do
nothing for simple protected objects.

The change also removes redundant calls to the Is_Simple_Protected_Type
predicate and fixes a minor inconsistency between Requires_Cleanup_Actions
and Build_Finalizer for this case.

gcc/ada/

	* exp_ch7.adb (Build_Finalizer.Process_Declarations): Remove call
	to Is_Simple_Protected_Type as redundant.
	(Build_Finalizer.Process_Object_Declaration): Do not retrieve the
	corresponding record type for simple protected objects. Make the
	flow of control more explicit in their specific processing.
	* exp_util.adb (Requires_Cleanup_Actions): Return false for simple
	protected objects present in library-level package bodies for the
	sake of consistency with Build_Finalizer and remove call to
	Is_Simple_Protected_Type as redundant.
  • [DBH] gcc/ada/exp_ch7.adb
  • [DBH] gcc/ada/exp_util.adb

ada: Fix infinite loop with multiple limited with clauses

ada: Fix infinite loop with multiple limited with clauses

This occurs when one of the types has an incomplete declaration in addition
to its full declaration in its package. In this case AI05-129 says that the
incomplete type is not part of the limited view of the package, i.e. only
the full view is. Now, in the GNAT implementation, it's the opposite in the
regular view of the package, i.e. the incomplete type is the visible one.

That's why the implementation needs to also swap the types on the visibility
chain while it is swapping the views when the clauses are either installed
or removed. This works correctly for the installation, but does not for the
removal, so this change rewrites the code doing the latter.

gcc/ada/
	PR ada/111434
	* sem_ch10.adb (Replace): New procedure to replace an entity with
	another on the homonym chain.
	(Install_Limited_With_Clause): Rename Non_Lim_View to Typ for the
	sake of consistency.  Call Replace to do the replacements and split
	the code into the regular and the special cases.  Add debuggging
	output controlled by -gnatdi.
	(Install_With_Clause): Print the Parent_With and Implicit_With flags
	in the debugging output controlled by -gnatdi.
	(Remove_Limited_With_Unit.Restore_Chain_For_Shadow (Shadow)): Rewrite
	using a direct replacement of E4 by E2.   Call Replace to do the
	replacements.  Add debuggging output controlled by -gnatdi.
  • [DBH] gcc/ada/sem_ch10.adb

ada: Fix bad finalization of limited aggregate in conditional expression

ada: Fix bad finalization of limited aggregate in conditional expression

This happens when the conditional expression is immediately returned, for
example in an expression function.

gcc/ada/

	* exp_aggr.adb (Is_Build_In_Place_Aggregate_Return): Return true
	if the aggregate is a dependent expression of a conditional
	expression being returned from a build-in-place function.
  • [DBH] gcc/ada/exp_aggr.adb

ada: Fix internal error on too large representation clause for small component

ada: Fix internal error on too large representation clause for small component

This is a small bug present on strict-alignment platforms for questionable
representation clauses.

gcc/ada/

	* gcc-interface/decl.cc (inline_status_for_subprog): Minor tweak.
	(gnat_to_gnu_field): Try harder to get a packable form of the type
	for a bitfield.
  • [DBH] gcc/ada/gcc-interface/decl.cc

ada: Remove superfluous setter procedure

ada: Remove superfluous setter procedure

It is only called once.

gcc/ada/

	* sem_util.ads (Set_Scope_Is_Transient): Delete.
	* sem_util.adb (Set_Scope_Is_Transient): Likewise.
	* exp_ch7.adb (Create_Transient_Scope): Set Is_Transient directly.
  • [DBH] gcc/ada/exp_ch7.adb
  • [DBH] gcc/ada/sem_util.adb
  • [DBH] gcc/ada/sem_util.ads

ada: Fix spurious -Wstringop-overflow with link time optimization

ada: Fix spurious -Wstringop-overflow with link time optimization

It comes from an incomplete optimization performed by LTO that is caused by
an obsolete transformation done in Gigi, which is redundant with the common
uniquization of constant CONSTRUCTORs now performed during gimplification.

gcc/ada/

	* gcc-interface/trans.cc (gnat_gimplify_expr) <CALL_EXPR>: Delete.
  • [DBH] gcc/ada/gcc-interface/trans.cc
โŒ