โŒ About FreshRSS

Normal view

There are new articles available, click to refresh the page.
Before yesterdaygcc/ada history

ada: Rename Is_Constr_Subt_For_UN_Aliased flag

28 November 2023 at 19:46
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
  • 28 November 2023 at 19:46

ada: Further cleanup in finalization machinery

24 November 2023 at 15:26
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
  • 24 November 2023 at 15:26

ada: Add missing guard to previous change

24 November 2023 at 11:07
ada: Add missing guard to previous change

Ancestor_Type is overloaded with Aggregate_Bounds on N_Aggregate nodes
so its access needs to be guarded in Copy_Generic_Node.

gcc/ada/

	* sem_ch12.adb (Copy_Generic_Node): Add guard for Ancestor_Type.
  • [DBH] gcc/ada/sem_ch12.adb
  • 24 November 2023 at 11:07

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

22 November 2023 at 15:29
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
  • 22 November 2023 at 15:29

ada: Fix internal error on call with parameter of predicated subtype

28 September 2023 at 13:53
ada: Fix internal error on call with parameter of predicated subtype

The problem is that the predicated subtype does not inherit all the required
attributes of a string subtype with a static predicate.

gcc/ada/

	* sem_ch3.adb (Analyze_Subtype_Declaration): Remove a short-circuit
	for subtypes without aspects when it comes to predicates.
	* sem_util.adb (Inherit_Predicate_Flags): Deal with private subtypes
	whose full view is an Itype.
  • [DBH] gcc/ada/sem_ch3.adb
  • [DBH] gcc/ada/sem_util.adb
  • 28 September 2023 at 13:53

ada: Rework fix for wrong finalization of qualified aggregate in allocator

20 November 2023 at 07:58
ada: Rework fix for wrong finalization of qualified aggregate in allocator

The problem is that there is no easy method to insert an action after an
arbitrary node in the tree, so the original fix does not correctly work
when the allocator is nested in another expression.

Therefore this moves the burden of the insertion from Apply_Predicate_Check
to Expand_Allocator_Expression and restricts the new processing to the case
where it is really required.

gcc/ada/

	* checks.ads (Apply_Predicate_Check): Add Deref boolean parameter.
	* checks.adb (Apply_Predicate_Check): Revert latest change. Use
	Loc local variable to hold the source location. Use a common code
	path for the generic processing and make a dereference if Deref is
	True.
	* exp_ch4.adb (Expand_Allocator_Expression): Compute Aggr_In_Place
	earlier. If it is true, do not call Apply_Predicate_Check on the
	expression on entry but on the temporary on exit with a
	dereference.
	* sem_res.adb (Resolve_Actuals): Add explicit parameter
	association in call to Apply_Predicate_Check.
  • [DBH] gcc/ada/checks.adb
  • [DBH] gcc/ada/checks.ads
  • [DBH] gcc/ada/exp_ch4.adb
  • [DBH] gcc/ada/sem_res.adb
  • 20 November 2023 at 07:58

ada: Fix predicate check failure in Expand_Allocator_Expression

17 November 2023 at 10:56
ada: Fix predicate check failure in Expand_Allocator_Expression

The For_Special_Return_Object flag needs to be accessed on entry of the
procedure in case the allocator is rewritten during the processing.

gcc/ada/

	* exp_ch4.adb (Expand_Allocator_Expression): Add Special_Return
	boolean constant to hold the value of For_Special_Return_Object
	for the allocator and use it throughout the procedure.
  • [DBH] gcc/ada/exp_ch4.adb
  • 17 November 2023 at 10:56

ada: Fix wrong finalization for qualified aggregate of limited type in allocator

16 November 2023 at 18:45
ada: Fix wrong finalization for qualified aggregate of limited type in allocator

This happens with -gnata when the limited type has controlled components
and a predicate, because the predicate check generated for the aggregate
causes the creation of a temporary that is used as the expression of the
allocator.  Now this combination is illegal for a limited type, so the
compiler does not generate the deep adjustment that would be necessary
for the access value, which ultimately results in a wrong finalization.

gcc/ada/

	* checks.adb (Apply_Predicate_Check): Also deal specifically with
	an expression that is a qualified aggregate in an allocator.
  • [DBH] gcc/ada/checks.adb
  • 16 November 2023 at 18:45

ada: Fix incorrect quoting in documentation

16 November 2023 at 07:26
ada: Fix incorrect quoting in documentation

gcc/ada/

	* doc/gnat_rm/the_implementation_of_standard_i_o.rst: Fix a couple
	occurrences of incorrect quoting.
	* gnat_rm.texi: Regenerate.
  • [DBH] gcc/ada/doc/gnat_rm/the_implementation_of_standard_i_o.rst
  • [DBH] gcc/ada/gnat_rm.texi
  • 16 November 2023 at 07:26

ada: Further cleanup in finalization machinery

9 November 2023 at 14:00
ada: Further cleanup in finalization machinery

When transient scopes are being materialized, they can give rise to a block
created around the construct being wrapped or not, depending on the kind of
construct.  In both cases finalization actions for the transient objects of
the scope are generated the same way, with normal finalization done manually
immediately after the construct and exceptional finalization deferred to the
enclosing scope by means of a hooking mechanism.

Now when the block is generated, it becomes this enclosing scope, so the
normal finalization that comes with it would also be done immediately after
the construct, even without normal finalization generated manually.

Therefore this change gets rid of the manual finalization as well as of the
hooking in the cases where the block is generated, leading to a significant
streamlining of the expanded code in these cases.  This requires fixing a
small inaccuracy of the Within_Case_Or_If_Expression predicate, which must
only be concerned with the dependent expressions, since those are the only
ones to be treated specially by the finalization machinery.

It also contains a small cleanup for the description of the transient scope
management present at the beginning of the exp_ch7.adb file.

gcc/ada/

	* exp_ch7.ads (Expand_Cleanup_Actions): Move declaration to the
	Finalization Management section.
	* exp_ch7.adb (Transient Scope Management): Move description down to
	after that of the general finalization and make a few changes.
	(Insert_Actions_In_Scope_Around): Call Process_Transients_In_Scope
	only if cleanups are being handled.
	(Process_Transients_In_Scope): Remove redundant test on Clean.
	* exp_util.ads (Within_Case_Or_If_Expression): Adjust description.
	* exp_util.adb (Within_Case_Or_If_Expression): Only return true if
	within the dependent expressions of the conditional expressions.
  • [DBH] gcc/ada/exp_ch7.adb
  • [DBH] gcc/ada/exp_ch7.ads
  • [DBH] gcc/ada/exp_util.adb
  • [DBH] gcc/ada/exp_util.ads
  • 9 November 2023 at 14:00

ada: Fix premature finalization for nested return within extended one

8 November 2023 at 22:29
ada: Fix premature finalization for nested return within extended one

The return object is incorrectly finalized when the nested return is taken,
because the special flag attached to the return object is not updated.

gcc/ada/

	* exp_ch6.adb (Build_Flag_For_Function): New function made up of the
	code building the special flag for return object present...
	(Expand_N_Extended_Return_Statement): ...in there.  Replace the code
	with a call to Build_Flag_For_Function.  Add assertion for the flag.
	(Expand_Non_Function_Return): For a nested return, if the return
	object needs finalization actions, update the special flag.
  • [DBH] gcc/ada/exp_ch6.adb
  • 8 November 2023 at 22:29

ada: Fix internal error on declare expression in expression function

6 November 2023 at 22:34
ada: Fix internal error on declare expression in expression function

When the expression function is not a completion, its (return) expression
does not cause freezing so analyzing the declare expression in this context
must not freeze the type of the object.

The change also contains another fix, which makes it so that the compiler
does not evaluate a nonstatic representation attribute of a scalar subtype
in the same context if the subtype is not already frozen.

gcc/ada/

	* sem_attr.adb (Eval_Attribute): Do not proceed in a spec expression
	for nonstatic representation attributes of a scalar subtype when the
	subtype is not frozen.
	* sem_ch3.adb (Analyze_Object_Declaration): Do not freeze the type
	of the object in a spec expression.
  • [DBH] gcc/ada/sem_attr.adb
  • [DBH] gcc/ada/sem_ch3.adb
  • 6 November 2023 at 22:34

ada: Another couple of cleanups in the finalization machinery

2 November 2023 at 14:05
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.
  • [DBH] gcc/ada/exp_ch7.adb
  • [DBH] gcc/ada/inline.adb
  • 2 November 2023 at 14:05

ada: Small consistency fix for -gnatwv warning

31 October 2023 at 16:49
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.
  • [DBH] gcc/ada/sem_warn.adb
  • 31 October 2023 at 16:49

ada: Fix internal error on 'Address of task component

31 October 2023 at 16:27
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.
  • [DBH] gcc/ada/sem_attr.adb
  • 31 October 2023 at 16:27

ada: Further cleanup in finalization machinery

27 October 2023 at 09:34
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.
  • [DBH] gcc/ada/sem_ch12.adb
  • 27 October 2023 at 09:34
โŒ
โŒ