โŒ About FreshRSS

Reading view

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

ada: Missing error on positional container aggregates for types with Add_Named

ada: Missing error on positional container aggregates for types with Add_Named

The compiler fails to reject a container aggregate written using positional
notation when the container type specifies an Add_Named operation in its
Aggregate aspect. Container aggregates for such types must be written using
named associations. The compiler ignores the positional associations and
produces an empty aggregate object. An error check is added to catch such
illegal container aggregates.

gcc/ada/

	* sem_aggr.adb (Resolve_Container_Aggregate): In the Add_Named
	case, issue an error if the container aggregate is written as a
	positional aggregate, since such an aggregate must have named
	associations.
  • [DBH] gcc/ada/sem_aggr.adb

ada: Remove GNATcheck violations

ada: Remove GNATcheck violations

Remove GNATcheck violations by refactoring code and also using
pragma Annotate to exempt them.

gcc/ada/

	* libgnat/a-comlin.adb (Argument_Count): Rewrite code so there is
	only one return, to remove Improper_Returns violation.
	(Command_Name): Add pragma to exempt Improper_Returns violation.
  • [DBH] gcc/ada/libgnat/a-comlin.adb

ada: Compiler hangs on container aggregate with function call as key expression

ada: Compiler hangs on container aggregate with function call as key expression

The compiler hangs (or may crash, if assertions are enabled) when compiling
an iterated association of a container aggregate that has a key expression
given by a function call. The resolution of the call leads to a blowup in
Build_Call_Marker, because the temporary copy of the expression that's
analyzed has an Empty parent, causing insertion of the call marker to fail.
The fix for this is to preanalyze, rather than analyze, the copy of the key
expression (Build_Call_Marker will return without creating a call marker in
the case of preanalysis).

gcc/ada/

	* sem_aggr.adb (Resolve_Iterated_Association): Call
	Preanalyze_And_Resolve instead of Analyze_And_Resolve on a key
	expression of an iterated association.
  • [DBH] gcc/ada/sem_aggr.adb

ada: Remove unreferenced utility routine Get_Logical_Line_Number_Img

ada: Remove unreferenced utility routine Get_Logical_Line_Number_Img

Routine Get_Logical_Line_Number_Img was introduced for splitting of
Pre/Post contracts, but subsequent patch for that feature removed its
only use. It was then used by GNATprove, but that use is now removed
as well.

gcc/ada/

	* sinput.adb, sinput.ads (Get_Logical_Line_Number_Img): Remove.
  • [DBH] gcc/ada/sinput.adb
  • [DBH] gcc/ada/sinput.ads

ada: gnatbind: Do not generate Ada.Command_Line references when not used

ada: gnatbind: Do not generate Ada.Command_Line references when not used

It was previously assumed that configurable runtimes could not return exit
statuses, however this assumption no longer holds. Instead, only import
the required symbols from Ada.Command_Line's support packages if
Ada.Command_Line is in the closure of the partition when a configurable
runtime is used.

gcc/ada/

	* bindgen.adb (Command_Line_Used): New object.
	(Gen_Main): Only generate references to symbols used by
	Ada.Command_Line if the package is used by the partition.
	(Gen_Output_File_Ada): Ditto.
	(Resolve_Binder_Options): Check if Ada.Command_Line is in the
	closure of the partition.
  • [DBH] gcc/ada/bindgen.adb

ada: Rename Is_Constr_Subt_For_UN_Aliased flag

ada: Rename Is_Constr_Subt_For_UN_Aliased flag

The flag is set on the constructed subtype of an object with unconstrained
nominal subtype that is aliased and is used by the code generator to adjust
the layout of the object.

But it is actually only used for array subtypes, where it determines whether
the object is allocated with its bounds, and this usage could be extended to
other cases than the original case.

gcc/ada/

	* einfo.ads (Is_Constr_Subt_For_UN_Aliased): Rename into...
	(Is_Constr_Array_Subt_With_Bounds): ...this.
	* exp_ch3.adb (Expand_N_Object_Declaration): Adjust to above
	renaming and remove now redundant test.
	* sem_ch3.adb (Analyze_Object_Declaration): Likewise, but set
	Is_Constr_Array_Subt_With_Bounds only on arrays.
	* gen_il-fields.ads (Opt_Field_Enum): Apply same renaming.
	* gen_il-gen-gen_entities.adb (Entity_Kind): Likewise.
	* gen_il-internals.adb (Image): Remove specific processing for
	Is_Constr_Subt_For_UN_Aliased.
	* treepr.adb (Image): Likewise.
	* gcc-interface/decl.cc (gnat_to_gnu_entity): Adjust to renaming
	and remove now redundant tests.
	* gcc-interface/trans.cc (Identifier_to_gnu): Likewise.
	(Call_to_gnu): Likewise.
  • [DBH] gcc/ada/einfo.ads
  • [DBH] gcc/ada/exp_ch3.adb
  • [DBH] gcc/ada/gcc-interface/decl.cc
  • [DBH] gcc/ada/gcc-interface/trans.cc
  • [DBH] gcc/ada/gen_il-fields.ads
  • [DBH] gcc/ada/gen_il-gen-gen_entities.adb
  • [DBH] gcc/ada/gen_il-internals.adb
  • [DBH] gcc/ada/sem_ch3.adb
  • [DBH] gcc/ada/treepr.adb

ada: Remove No_Dynamic_Priorities from Restricted_Tasking

ada: Remove No_Dynamic_Priorities from Restricted_Tasking

Some of our restricted runtimes support dynamic priorities. The binder
needs to generate code for a restricted runtime even if the restriction
No_Dynamic_Priorities is not in place.

gcc/ada/

	* libgnat/s-rident.ads: Remove No_Dynamic_Priorities from
	Restricted_Tasking.
  • [DBH] gcc/ada/libgnat/s-rident.ads

ada: Fix crash on concurrent type aggregate

ada: Fix crash on concurrent type aggregate

Before this patch, the compiler would fail to examine the corresponding
record types of concurrent types when building aggregate components.
This patch fixes this, and adds a precondition and additional documentation
on the subprogram that triggered the crash, as it never makes sense
to call it with a concurrent type.

gcc/ada/

	* exp_aggr.adb (Initialize_Component): Use corresponding record
	types of concurrent types.
	* exp_util.ads (Make_Tag_Assignment_From_Type): Add precondition
	and extend documentation.

Co-authored-by: Javier Miranda <[email protected]>
  • [DBH] gcc/ada/exp_aggr.adb
  • [DBH] gcc/ada/exp_util.ads

ada: Further cleanup in finalization machinery

ada: Further cleanup in finalization machinery

This removes the setting of the Is_Ignored_Transient flag on the temporaries
needing finalization created by Expand_Ctrl_Function_Call when invoked from
within the dependent expressions of conditional expressions.

This flag tells the general finalization machinery to disregard the object.
But temporaries needing finalization present in action lists of dependent
expressions are picked up by Process_Transients_In_Expression, which deals
with their finalization and sets the Is_Finalized_Transient flag on them.

Now this latter flag has exactly the same effect as Is_Ignored_Transient
as far as the general finalization machinery is concerned, so setting the
flag is unnecessary.  In the end, the flag can be decoupled entirely from
transient objects and renamed into Is_Ignored_For_Finalization.

This also moves around the declaration of a local variable and turns a
library-level procedure into a nested procedure.

gcc/ada/

	* einfo.ads (Is_Ignored_Transient): Rename into...
	(Is_Ignored_For_Finalization): ...this.
	* gen_il-fields.ads (Opt_Field_Enum): Adjust to above renaming.
	* gen_il-gen-gen_entities.adb (Object_Kind): Likewise.
	* exp_aggr.adb (Expand_Array_Aggregate): Likewise.
	* exp_ch7.adb (Build_Finalizer.Process_Declarations): Likewise.
	* exp_util.adb (Requires_Cleanup_Actions): Likewise.
	* exp_ch4.adb (Expand_N_If_Expression): Move down declaration of
	variable Optimize_Return_Stmt.
	(Process_Transient_In_Expression): Turn procedure into a child of...
	(Process_Transients_In_Expression): ...this procedure.
	* exp_ch6.adb (Expand_Ctrl_Function_Call): Remove obsolete setting
	of Is_Ignored_Transient flag on the temporary if within a dependent
	expression of a conditional expression.
  • [DBH] gcc/ada/einfo.ads
  • [DBH] gcc/ada/exp_aggr.adb
  • [DBH] gcc/ada/exp_ch4.adb
  • [DBH] gcc/ada/exp_ch6.adb
  • [DBH] gcc/ada/exp_ch7.adb
  • [DBH] gcc/ada/exp_util.adb
  • [DBH] gcc/ada/gen_il-fields.ads
  • [DBH] gcc/ada/gen_il-gen-gen_entities.adb

ada: Fix SPARK expansion of container aggregates

ada: Fix SPARK expansion of container aggregates

GNATprove supports container aggregates, except for indexed aggregates.
It needs all expressions to have suitable target types and Do_Range_Check
flags, which are added by the special expansion for GNATprove.

There is no impact on code generation.

gcc/ada/

	* exp_spark.adb (Expand_SPARK_N_Aggregate): New procedure for the
	special expansion.
	(Expand_SPARK): Call the new expansion procedure.
	* sem_util.adb (Is_Container_Aggregate): Implement missing test.
  • [DBH] gcc/ada/exp_spark.adb
  • [DBH] gcc/ada/sem_util.adb

ada: Fix spurious visibility error on parent's component in instance

ada: Fix spurious visibility error on parent's component in instance

This occurs for an aggregate of a derived tagged type in the body of the
instance, because the full view of the parent type, which was visible in
the generic construct (otherwise the aggregate would have been illegal),
is not restored in the body of the instance.

Copy_Generic_Node already contains code to restore the full view in this
case, but it works only if the derived tagged type is itself global to
the generic construct, and not if the derived tagged type is local but
the parent type global, as is the case here.

gcc/ada/

	* gen_il-fields.ads (Aggregate_Bounds): Rename to
	Aggregate_Bounds_Or_Ancestor_Type.
	* gen_il-gen-gen_nodes.adb (Aggregate_Bounds): Likewise.
	* sem_aggr.adb (Resolve_Record_Aggregate): Remove obsolete bypass.
	* sem_ch12.adb (Check_Generic_Actuals): Add decoration.
	(Copy_Generic_Node): For an extension aggregate, restore only the
	full view, if any.  For a full aggregate, restore the full view as
	well as that of its Ancestor_Type, if any, and up to the root type.
	(Save_References_In_Aggregate): For a full aggregate of a local
	derived tagged type with a global ancestor, set Ancestor_Type to
	this ancestor.  For a full aggregate of a global derived tagged
	type, set Ancestor_Type to the parent type.
	* sinfo-utils.ads (Aggregate_Bounds): New function renaming.
	(Ancestor_Type): Likewise.
	(Set_Aggregate_Bounds): New procedure renaming.
	(Set_Ancestor_Type): Likewise.
	* sinfo.ads (Ancestor_Type): Document new field.
  • [DBH] gcc/ada/gen_il-fields.ads
  • [DBH] gcc/ada/gen_il-gen-gen_nodes.adb
  • [DBH] gcc/ada/sem_aggr.adb
  • [DBH] gcc/ada/sem_ch12.adb
  • [DBH] gcc/ada/sinfo-utils.ads
  • [DBH] gcc/ada/sinfo.ads
โŒ